commit 153bfef0c47686dd8d01093cc12a1c65cc799182
parent 6c65c12a6c9b740fe6b79534e2731e5e92a4c27f
Author: Sascha Silbe <sascha-pgp@silbe.org>
Date: Wed, 29 Sep 2010 10:16:15 -0400
fix searching for non-lowercase labels
Case is preserved when marshalling labels (stored as document data), but label
terms are stored lowercase. build_xapian_query uses mkterm and thus already
converts labels to lowercase when searching. parse_query accepts a Xapian
query string from the user and needs to explicitly convert labels to
lowercase, which it now does.
Signed-off-by: Sascha Silbe
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/lib/sup/index.rb b/lib/sup/index.rb
@@ -331,6 +331,12 @@ EOS
end
end
+ ## labels are stored lower-case in the index
+ subs = subs.gsub(/\blabel:(\S+)\b/) do
+ label = $1
+ "label:#{label.downcase}"
+ end
+
## if we see a label:deleted or a label:spam term anywhere in the query
## string, we set the extra load_spam or load_deleted options to true.
## bizarre? well, because the query allows arbitrary parenthesized boolean