[tracker/rss-enclosures] fixes GB#619826 TST: for search & history, don't clean-up search terms
- From: Roberto Guido <rguido src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/rss-enclosures] fixes GB#619826 TST: for search & history, don't clean-up search terms
- Date: Sat, 26 Jun 2010 23:11:07 +0000 (UTC)
commit 83306512e4c5382f7ece333eee07493d6fc54641
Author: Tshepang Lekhonkhobe <tshepang gmail com>
Date: Thu May 27 16:23:33 2010 +0200
fixes GB#619826 TST: for search & history, don't clean-up search terms
* TST was trying to be smart by cleaning-up search terms
(removing non-alphanumeric characters) before using them to
query as well as before storing them in history.
* This change allows TST to send the search terms as-is to
tracker-store, but as for history, it first strips both leading
and trailing whitespace, while also applying normalization.
src/tracker-search-tool/tracker-entry.gs | 36 +++++++++--------------------
1 files changed, 11 insertions(+), 25 deletions(-)
---
diff --git a/src/tracker-search-tool/tracker-entry.gs b/src/tracker-search-tool/tracker-entry.gs
index 4b44ff9..4ea9c3c 100644
--- a/src/tracker-search-tool/tracker-entry.gs
+++ b/src/tracker-search-tool/tracker-entry.gs
@@ -78,34 +78,20 @@ class TrackerSearchEntry : ComboBoxEntry implements Gtk.Activatable
Query.SearchTerms = ""
return false
- /* remove leading whitespace */
- txt = txt.chug()
-
- var len = txt.len()
- if len > 2
-
- /* remove leading non-alphanumeric chars */
- while(!txt[0].isalnum())
- if txt[0] == '_'
- break
- txt = txt.slice(1, len--)
- if len < 3
- return false
+ Query.SearchTerms = EscapeSparql (txt, true)
- /* remove trailing non-alphanumeric chars */
- if(!txt[len - 1].isalnum())
- while(!txt[len - 2].isalnum())
- if txt[len - 2] == '_'
- break
- txt = txt.slice(0, len - 2)
- len--
- if len < 3
- return false
+ /* remove leading and trailing whitespace before inserting items into
+ * history; this avoids having both "term" and " term " in there;
+ */
+ txt = txt.strip()
- /* hit tracker-store */
- Query.SearchTerms = EscapeSparql (txt, true)
+ /* ensure that accented chars are represented the same way to
+ * avoid duplicated entries in history
+ */
+ txt = txt.normalize(-1, NormalizeMode.NFC)
- /* do not store duplicate strings in history */
+ if txt.len() > 2
+ /* do not store items in history */
for item in history
if txt == item
return false
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]