GNOME Bugzilla – Bug 759587
Refactor Tracker queries
Last modified: 2016-01-03 18:29:42 UTC
As pointed out at https://bugzilla.gnome.org/show_bug.cgi?id=739924#c7
Created attachment 318091 [details] [review] configure: Depend on Tracker >= 1.7.1 This is the first version providing all the sparql 1.1 features we'll be using in the following patches.
Created attachment 318092 [details] [review] query: Rework albums query The query can be greatly simplified if done as a song query grouped by album. The several tracker:uri-is-descendant() can be then done at once in the main query, and the tracker:uri-is-descendant calls themselves have been replaced with pure string checks, which will yield better performance over large sets.
Created attachment 318093 [details] [review] query: Rework songs query No large functional changes, the path matching is performed using pure string operations though. The filters for the music pieces not being videos or playlists has been removed too. If that happens, it is plainly a Tracker bug, no need to tap over it.
Created attachment 318094 [details] [review] query: Rework song count query No large functional changes, the path matching is performed using pure string operations though. The filters for the music pieces not being videos or playlists has been removed too. If that happens, it is plainly a Tracker bug, no need to tap over it.
Created attachment 318095 [details] [review] query: Rework artists query Similarly to the albums query, this query turns out simpler by doing it as a query grouped by album. The same simplifications apply.
Created attachment 318096 [details] [review] query: Rework "songs for album" query No large functional changes, the path matching is performed using pure string operations though. The filters for the music pieces not being videos or playlists has been removed too. If that happens, it is plainly a Tracker bug, no need to tap over it.
Created attachment 318097 [details] [review] query: rework playlists query No need to deep nest filters and optionals, it can all be done in the main query.
Created attachment 318098 [details] [review] query: rework search subqueries The artist/album/song match subgraphs/subqueries can be greatly simplified using FTS. However the "any" match would be better performed as the union of 3 different selects, so we'd need to perform an outer query modification instead of an inner one. Despite keeping the "any" match largely the same, use sparql1.1 to reduce/improve verbosity.
Created attachment 318099 [details] [review] query: Use sparql 1.1 syntax on order_by_statement() We now implicitly rely on the given term to be lower cased, because it's now preemptively lowercased in the places calling this function.
Review of attachment 318091 [details] [review]: sure.
Review of attachment 318092 [details] [review]: sure.
Review of attachment 318093 [details] [review]: sure.
Review of attachment 318094 [details] [review]: sure.
Review of attachment 318095 [details] [review]: sure.
Review of attachment 318096 [details] [review]: sure!
Review of attachment 318097 [details] [review]: sure.
Review of attachment 318098 [details] [review]: sure.
Review of attachment 318099 [details] [review]: sure!
Thanks! Attachment 318091 [details] pushed as 5bc67ac - configure: Depend on Tracker >= 1.7.1 Attachment 318092 [details] pushed as 0d28004 - query: Rework albums query Attachment 318093 [details] pushed as 571f219 - query: Rework songs query Attachment 318094 [details] pushed as 04fbd8a - query: Rework song count query Attachment 318095 [details] pushed as cf4acf6 - query: Rework artists query Attachment 318096 [details] pushed as 5a81196 - query: Rework "songs for album" query Attachment 318097 [details] pushed as 120b275 - query: rework playlists query Attachment 318098 [details] pushed as 0b169a9 - query: rework search subqueries Attachment 318099 [details] pushed as 7eff30a - query: Use sparql 1.1 syntax on order_by_statement()