[nautilus] tracker-engine: apply basename heuristic to tracker hits too
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] tracker-engine: apply basename heuristic to tracker hits too
- Date: Mon, 15 Oct 2012 14:04:38 +0000 (UTC)
commit 97b616d4f462571f8cce4d72a99478ddc89e5936
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Sun Oct 14 18:55:45 2012 -0400
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.
.../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 1d002fb..5b6b58e 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]