[tracker/fts4: 21/26] tracker-needle: display snippet where available



commit faca29c929f103373e3172889b9e8cd022244efd
Author: Carlos Garnacho <carlos lanedo com>
Date:   Fri Jan 25 18:54:00 2013 +0100

    tracker-needle: display snippet where available

 src/tracker-needle/tracker-needle.vala |    8 ++++----
 src/tracker-needle/tracker-view.vala   |    1 +
 2 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/tracker-needle/tracker-needle.vala b/src/tracker-needle/tracker-needle.vala
index efcb4e1..4350769 100644
--- a/src/tracker-needle/tracker-needle.vala
+++ b/src/tracker-needle/tracker-needle.vala
@@ -105,7 +105,7 @@ public class Tracker.Needle {
 		                            Tracker.Query.Match.FTS,
 		                            "?urn",
 		                            "nie:url(?urn)",
-		                            "tracker:coalesce(nie:title(?urn), nfo:fileName(?urn))",
+		                            "tracker:coalesce(fts:snippet(?urn),nie:title(?urn), nfo:fileName(?urn))",
 		                            "\"\"",
 		                            "nfo:duration(?urn)",
 		                            "nie:url(?urn)");
@@ -114,7 +114,7 @@ public class Tracker.Needle {
 		                            "?urn",
 		                            "nie:url(?urn)",
 		                            "tracker:coalesce(nie:title(?urn), nfo:fileName(?urn))",
-		                            "tracker:coalesce(nco:fullname(?creator), nco:fullname(?publisher))",
+		                            "tracker:coalesce(fts:snippet(?urn),nco:fullname(?creator), nco:fullname(?publisher))",
 		                            "nfo:pageCount(?urn)",
 		                            "nie:url(?urn)");
 		categories_model.add_query (Tracker.Query.Type.MAIL,
@@ -122,14 +122,14 @@ public class Tracker.Needle {
 		                            "?urn",
 		                            "nie:url(?urn)",
 		                            "nmo:messageSubject(?urn)",
-		                            "tracker:coalesce(nco:fullname(?sender), nco:nickname(?sender), nco:emailAddress(?sender))",
+		                            "tracker:coalesce(fts:snippet(?urn),nco:fullname(?sender), nco:nickname(?sender), nco:emailAddress(?sender))",
 		                            "nmo:receivedDate(?urn)",
 		                            "fn:concat(\"To: \", tracker:coalesce(nco:fullname(?to), nco:nickname(?to), nco:emailAddress(?to)))");
 		categories_model.add_query (Tracker.Query.Type.FOLDERS,
 		                            Tracker.Query.Match.FTS,
 		                            "?urn",
 		                            "nie:url(?urn)",
-		                            "tracker:coalesce(nie:title(?urn), nfo:fileName(?urn))",
+		                            "tracker:coalesce(fts:snippet(?urn),nie:title(?urn), nfo:fileName(?urn))",
 		                            "nie:url(?parent)",
 		                            "nfo:fileLastModified(?urn)",
 		                            "?tooltip");
diff --git a/src/tracker-needle/tracker-view.vala b/src/tracker-needle/tracker-view.vala
index a2626cd..07d6981 100644
--- a/src/tracker-needle/tracker-view.vala
+++ b/src/tracker-needle/tracker-view.vala
@@ -362,6 +362,7 @@ public class Tracker.View : ScrolledWindow {
 				markup = Markup.escape_text (text);
 
 				if (subtext != null) {
+					subtext = subtext.replace ("\n", " ");
 					markup += "\n<small><span color='grey'>%s</span></small>".printf (Markup.escape_text (subtext));
 				}
 			} else {



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