GNOME Bugzilla – Bug 748539
Eliminate duplicates in grl-tracker search results
Last modified: 2015-07-31 12:26:04 UTC
If I call grl_source_search() on a grl-tracker source, it can return the same URI in multiple GrlMedias. This can happen if that file is a video with an audio stream — but it will be returned as a GrlMediaVideo multiple times. If I constrain the result types using grl_operation_options_set_type_filter (options, GRL_TYPE_FILTER_VIDEO); then a single result for each URI is returned, as expected. Is this intentional? grl-tracker-source-api.c uses DISTINCT in some of its queries (for browse and resolve, but not search) if the browse-filesystem config key is enabled. Why is search different? And what does browse-filesystem semantically have to do with the uniqueness of results?
Created attachment 302463 [details] [review] tracker: Eliminate duplicate search results Add a DISTINCT to the query to eliminate duplicate search results when using grl_source_browse() on a grl-tracker source. Unlike other uses of DISTINCT in the source, it is not conditional on the browse-filesystem config key being enabled.
Review of attachment 302463 [details] [review]: Patch looks good.
(In reply to Bastien Nocera from comment #2) > Review of attachment 302463 [details] [review] [review]: > > Patch looks good. Is that a_c-n?
(In reply to Philip Withnall from comment #3) > (In reply to Bastien Nocera from comment #2) > > Review of attachment 302463 [details] [review] [review] [review]: > > > > Patch looks good. > > Is that a_c-n? I was expecting somebody who knows the tracker code better than I do to comment, but I guess that's as good an answer as we'll get for now. Please commit.
FWIW, this looks correct to me, although the defines are highly generic skeletons of queries, I can't ensure that DISTINCT will be the thing you expect in all the queries that could be constructed with those. Although in the context of grilo, it is likely desirable on almost every situation.
Thanks for the review. Attachment 302463 [details] pushed as e1a233d - tracker: Eliminate duplicate search results