GNOME Bugzilla – Bug 680163
Use a ranking algorithm for displaying search results
Last modified: 2012-08-01 11:20:18 UTC
I think it might be nice to have a ranking algorithm that can be used to determine the order of search results displayed. Currently, we sort the result by name by default I think. It may be nice to be able to sort the results by: * Relevance * Use (frecency?) * Name The rank should account for at least: * Proximity to current location * Time since last use * Time since last modification * Text match score One possibility would be to add a column to the search directory view for something like "Relevance" etc. The problem is that the value used in this column would be unintelligible most of the time.
Created attachment 219274 [details] [review] Add a way to rank search results We give each search hit a relevance score computed from the sum of proximity, recent, and text match bonuses. The search results are ordered by this value by default.
Created attachment 219368 [details] [review] Add a way to rank search results We give each search hit a relevance score computed from the sum of proximity, recent, and text match bonuses. The search results are ordered by this value by default.
Review of attachment 219368 [details] [review]: Looks mostly good, just some comments below. ::: libnautilus-private/nautilus-search-engine-simple.c @@ +275,3 @@ + GDateTime *dt; + + hit = nautilus_search_hit_new (g_file_get_uri (child)); This leaks the uri ::: libnautilus-private/nautilus-search-hit.c @@ +51,3 @@ +void +nautilus_search_hit_score (NautilusSearchHit *hit, + NautilusQuery *query) The API of this is a little weird, we could just return the relevance score from the function, instead of having a separate function (or keep both, but it looks to me that returning it from here would be enough for the use we make of it in NautilusSearchDirectory). @@ +111,3 @@ + else { + recent_bonus = 100.0; + } The coding style for these if branches here is inconsistent...in Nautilus we always put curly braces around conditions, even if the condition is one line. @@ +243,3 @@ + NautilusSearchHit *hit = NAUTILUS_SEARCH_HIT (object); + + g_free (hit->details->uri); Need to g_date_unref modification_time and access_time here.
Created attachment 220046 [details] [review] Add a way to rank search results We give each search hit a relevance score computed from the sum of proximity, recent, and text match bonuses. The search results are ordered by this value by default.
Attachment 220046 [details] pushed as 2156d24 - Add a way to rank search results