[nautilus/wip/antoniof/search-list-redesign: 2/2] search-engine-tracker: Elaborate snippet




commit ebf8f22a277a6241aecb37101dd94216ca4065c9
Author: António Fernandes <antoniof gnome org>
Date:   Wed Aug 3 10:03:05 2022 +0100

    search-engine-tracker: Elaborate snippet
    
    Extend snippet up to 20 words ("tokens" in database parlance).
    
    Highlight matching word using pango markup.

 src/nautilus-name-cell.c             | 2 +-
 src/nautilus-search-engine-tracker.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-name-cell.c b/src/nautilus-name-cell.c
index eb57d2ee0..7cc3c2122 100644
--- a/src/nautilus-name-cell.c
+++ b/src/nautilus-name-cell.c
@@ -104,7 +104,7 @@ update_labels (NautilusNameCell *self)
 
     gtk_label_set_text (GTK_LABEL (self->label), display_name);
     gtk_label_set_text (GTK_LABEL (self->path), path_text);
-    gtk_label_set_text (GTK_LABEL (self->snippet), fts_snippet);
+    gtk_label_set_markup (GTK_LABEL (self->snippet), fts_snippet);
 
     gtk_widget_set_visible (self->path, (path_text != NULL));
     gtk_widget_set_visible (self->snippet_button, (fts_snippet != NULL));
diff --git a/src/nautilus-search-engine-tracker.c b/src/nautilus-search-engine-tracker.c
index e0c2c8c8d..0e1792690 100644
--- a/src/nautilus-search-engine-tracker.c
+++ b/src/nautilus-search-engine-tracker.c
@@ -357,7 +357,7 @@ nautilus_search_engine_tracker_start (NautilusSearchProvider *provider)
 
     if (tracker->fts_enabled && *search_text)
     {
-        g_string_append (sparql, " fts:snippet(?content)");
+        g_string_append (sparql, " fts:snippet(?content, '<b>', '</b>', '…', 20)");
     }
 
     g_string_append (sparql, "FROM tracker:FileSystem ");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]