[geary] Don't bother stemming and generating SQL for valid is:foo search terms.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary] Don't bother stemming and generating SQL for valid is:foo search terms.
- Date: Tue, 31 May 2016 07:51:40 +0000 (UTC)
commit 86ffc4c3b54a84c0cfeaa0556f56b04a1c6e954b
Author: Michael James Gratton <mike vee net>
Date: Tue May 31 17:45:18 2016 +1000
Don't bother stemming and generating SQL for valid is:foo search terms.
Further cleanup from Bug 766837.
* src/engine/imap-db/imap-db-account.vala
(Geary.ImapDB.Account::prepare_search_query): Only stem and generate
SQL terms that aren't is:foo operators.
src/engine/imap-db/imap-db-account.vala | 52 ++++++++++++++++++-------------
1 files changed, 30 insertions(+), 22 deletions(-)
---
diff --git a/src/engine/imap-db/imap-db-account.vala b/src/engine/imap-db/imap-db-account.vala
index db38d45..4bdc31a 100644
--- a/src/engine/imap-db/imap-db-account.vala
+++ b/src/engine/imap-db/imap-db-account.vala
@@ -974,29 +974,37 @@ private class Geary.ImapDB.Account : BaseObject {
string[] parts = s.split(":", 2);
if (parts.length > 1)
field = extract_field_from_token(parts, ref s);
-
- // SQL MATCH syntax for parsed term
- string? sql_s = "%s*".printf(s);
-
- // stem the word, but if stemmed and stem is simply shorter version of original
- // term, only prefix-match search for it (i.e. avoid searching for
- // [archive* OR archiv*] when that's the same as [archiv*]), otherwise search for
- // both
- string? stemmed = stem_search_term(query, s);
-
- string? sql_stemmed = null;
- if (stemmed != null) {
- sql_stemmed = "%s*".printf(stemmed);
- if (s.has_prefix(stemmed))
- sql_s = null;
+
+ if (field == SEARCH_OP_IS) {
+ // s will have been de-translated
+ term = new SearchTerm(original, s, null, null, null);
+ } else {
+ // SQL MATCH syntax for parsed term
+ string? sql_s = "%s*".printf(s);
+
+ // stem the word, but if stemmed and stem is
+ // simply shorter version of original term, only
+ // prefix-match search for it (i.e. avoid
+ // searching for [archive* OR archiv*] when that's
+ // the same as [archiv*]), otherwise search for
+ // both
+ string? stemmed = stem_search_term(query, s);
+
+ string? sql_stemmed = null;
+ if (stemmed != null) {
+ sql_stemmed = "%s*".printf(stemmed);
+ if (s.has_prefix(stemmed))
+ sql_s = null;
+ }
+
+ // if term contains continuation characters, treat
+ // as exact search to reduce effects of tokenizer
+ // splitting terms w/ punctuation in them
+ if (String.contains_any_char(s, SEARCH_TERM_CONTINUATION_CHARS))
+ s = "\"%s\"".printf(s);
+
+ term = new SearchTerm(original, s, stemmed, sql_s, sql_stemmed);
}
-
- // if term contains continuation characters, treat as exact search to reduce effects of
- // tokenizer splitting terms w/ punctuation in them
- if (String.contains_any_char(s, SEARCH_TERM_CONTINUATION_CHARS))
- s = "\"%s\"".printf(s);
-
- term = new SearchTerm(original, s, stemmed, sql_s, sql_stemmed);
}
if (in_quote && quotes % 2 != 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]