Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
From: Sascha Silbe <sascha-pgp@silbe.org>
To: sup-devel <sup-devel@rubyforge.org>
Subject: [sup-devel] [PATCH] fix searching for non-lowercase labels
Date: Wed, 29 Sep 2010 16:16:15 +0200	[thread overview]
Message-ID: <1285769775-15914-1-git-send-email-sascha-pgp@silbe.org> (raw)

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


             reply	other threads:[~2010-09-29 14:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-29 14:16 Sascha Silbe [this message]
2010-10-08  4:21 ` Rich Lane

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1285769775-15914-1-git-send-email-sascha-pgp@silbe.org \
    --to=sascha-pgp@silbe.org \
    --cc=sascha-ml-reply-to-2010-3@silbe.org \
    --cc=sup-devel@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox