GNOME Bugzilla – Bug 759331
Don't show empty albums in favorites
Last modified: 2015-12-15 13:55:14 UTC
If someone had created an album with some pictures in it, then marked it as favorite, and afterwards removed all the items from it, the album will still show up in Favorites. It shouldn't. This is because our inner SELECT looks like this: SELECT ?urn rdf:type (?urn) AS ?type COUNT (?item) AS ?count WHERE { ?urn nao:hasTag nao:predefined-tag-favorite } GROUP BY (?urn) Since ?item is undefined, COUNT(?item) comes out as COUNT(?urn), which is going to be greater than zero since the empty album has nao:predefined-tag-favorite attached to it. This beats the FILTER(?count > 0) in the outer SELECT and shows the empty album. Instead, our inner SELECT should be: SELECT ?urn rdf:type (?urn) AS ?type COUNT (?item) AS ?count WHERE { ?urn a rdfs:Resource; nao:hasTag nao:predefined-tag-favorite. OPTIONAL {?item a nie:InformationElement; nie:isPartOf ?urn} } GROUP BY (?urn)
This should complete the fix for bug 725589
Created attachment 317187 [details] [review] search-type-manager: Skip empty collections in Favorites
(In reply to Debarshi Ray from comment #0) > This is because our inner SELECT looks like this: > SELECT ?urn rdf:type (?urn) AS ?type COUNT (?item) AS ?count > WHERE { > ?urn nao:hasTag nao:predefined-tag-favorite > } > GROUP BY (?urn) The fact that tracker doesn't complain about the unbound ?foo is a bug. See bug 759361
Been using it for some days and I haven't seen any breakage. Pushed to master.