sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 5592634eaa2e8a94df034a8d94e87f94db22f98a
parent 4419e8536b0f8f02e8951abc48e1988400a372e1
Author: William Morgan <wmorgan-sup@masanjin.net>
Date:   Mon, 25 Feb 2008 09:04:07 -0800

remove query normalization, which was both useless and broken

OR queries were being translated incorrectly, date modifiers were being
mangled, and none of the text substitution stuff really depended on it.

Diffstat:
M lib/sup/index.rb | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/lib/sup/index.rb b/lib/sup/index.rb
@@ -400,18 +400,7 @@ protected
   def parse_user_query_string s
     extraopts = {}
 
-    ## this is a little hacky, but it works, at least until ferret changes
-    ## its api. we parse the user query string with ferret twice: the first
-    ## time we just turn the resulting object back into a string, which has
-    ## the next effect of transforming the original string into a nice
-    ## normalized form with + and - instead of AND, OR, etc. then we do some
-    ## string substitutions which depend on this normalized form, re-parse
-    ## the string with Ferret, and return the resulting query object.
-
-    norms = @qparser.parse(s).to_s
-    Redwood::log "normalized #{s.inspect} to #{norms.inspect}" unless s == norms
-
-    subs = norms.gsub(/\b(to|from):(\S+)\b/) do
+    subs = s.gsub(/\b(to|from):(\S+)\b/) do
       field, name = $1, $2
       if(p = ContactManager.contact_for(name))
         [field, p.email]
@@ -481,7 +470,6 @@ protected
       subs = nil if chronic_failure
     end
     
-    Redwood::log "translated #{norms.inspect} to #{subs.inspect}" unless subs == norms
     if subs
       [@qparser.parse(subs), extraopts]
     else