* [sup-devel] [PATCH] fix searching for non-lowercase labels
@ 2010-09-29 14:16 Sascha Silbe
2010-10-08 4:21 ` Rich Lane
0 siblings, 1 reply; 2+ messages in thread
From: Sascha Silbe @ 2010-09-29 14:16 UTC (permalink / raw)
To: sup-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [sup-devel] [PATCH] fix searching for non-lowercase labels
2010-09-29 14:16 [sup-devel] [PATCH] fix searching for non-lowercase labels Sascha Silbe
@ 2010-10-08 4:21 ` Rich Lane
0 siblings, 0 replies; 2+ messages in thread
From: Rich Lane @ 2010-10-08 4:21 UTC (permalink / raw)
To: Sascha Silbe; +Cc: sup-devel
Applied to master.
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-08 4:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-29 14:16 [sup-devel] [PATCH] fix searching for non-lowercase labels Sascha Silbe
2010-10-08 4:21 ` Rich Lane
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox