[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[sup-devel] [PATCH] 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 <sascha-pgp@silbe.org>
---
lib/sup/index.rb | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/lib/sup/index.rb b/lib/sup/index.rb
index a72bec6..f90d0d9 100644
--- a/lib/sup/index.rb
+++ b/lib/sup/index.rb
@@ -346,6 +346,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
--
1.7.1
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel