[tracker] Fixes NB#170915 - tracker-search for snippet is resulting in errors



commit bb9593e4085ffb7fbde87cb71c3ba62e1489f2bf
Author: Martyn Russell <martyn lanedo com>
Date:   Thu May 27 10:35:11 2010 +0100

    Fixes NB#170915 - tracker-search for snippet is resulting in errors

 src/tracker-utils/tracker-search.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/src/tracker-utils/tracker-search.c b/src/tracker-utils/tracker-search.c
index 723b3d6..a2b1375 100644
--- a/src/tracker-utils/tracker-search.c
+++ b/src/tracker-utils/tracker-search.c
@@ -1154,13 +1154,26 @@ main (int argc, char **argv)
 		g_thread_init (NULL);
 	}
 
-	/* Check terms are not stopwords */
 	if (terms) {
 		TrackerLanguage *language;
 		GHashTable *stop_words;
 		const gchar *stop_word_found;
 		gchar **p;
 
+		/* Check terms don't have additional quotes */
+		for (p = terms; *p; p++) {
+			gchar *term = *p;
+			gint end = strlen (term) - 1;
+
+			if ((term[0] == '"' && term[end] == '"') ||
+			    (term[0] == '\'' && term[end] == '\'')) {
+				/* We never have a quote JUST at the end */
+				term[0] = term[end] = ' ';
+				g_strstrip (term);
+			}
+		}
+
+		/* Check terms are not stopwords */
 		language = tracker_language_new (NULL);
 		stop_words = tracker_language_get_stop_words (language);
 



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