diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2012-10-14 18:55:45 -0400 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2012-10-15 10:02:48 -0400 |
commit | 2f673e0c7ff32c197154241809ac930e24b21e17 (patch) | |
tree | 21855939ac45babfdf217f44183d6e1361bb31ed | |
parent | 42b10d57e52956f491c5a6f8849b911c14cfaae9 (diff) | |
download | nautilus-2f673e0c7ff32c197154241809ac930e24b21e17.tar.gz |
tracker-engine: apply basename heuristic to tracker hits too
So that they get the same kind of bonus they would if they matched with
the other engines. The FTS rank that tracker gives us is added as
another bonus.
-rw-r--r-- | libnautilus-private/nautilus-search-engine-tracker.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libnautilus-private/nautilus-search-engine-tracker.c b/libnautilus-private/nautilus-search-engine-tracker.c index 1d002fb75..5b6b58ea3 100644 --- a/libnautilus-private/nautilus-search-engine-tracker.c +++ b/libnautilus-private/nautilus-search-engine-tracker.c @@ -116,8 +116,9 @@ cursor_callback (GObject *object, const char *mtime_str; const char *atime_str; GTimeVal tv; - gdouble rank; + gdouble rank, match; gboolean success, has_error; + gchar *basename; tracker = NAUTILUS_SEARCH_ENGINE_TRACKER (user_data); @@ -153,9 +154,13 @@ cursor_callback (GObject *object, rank = tracker_sparql_cursor_get_double (cursor, 1); mtime_str = tracker_sparql_cursor_get_string (cursor, 2, NULL); atime_str = tracker_sparql_cursor_get_string (cursor, 3, NULL); + basename = g_path_get_basename (uri); hit = nautilus_search_hit_new (uri); - nautilus_search_hit_set_fts_rank (hit, rank); + match = nautilus_query_matches_string (tracker->details->query, basename); + nautilus_search_hit_set_fts_rank (hit, rank + match); + g_free (basename); + if (g_time_val_from_iso8601 (mtime_str, &tv)) { GDateTime *dt; dt = g_date_time_new_from_timeval_local (&tv); |