changeset 251:1a2378d230d1

search: fixed whitespace handling in linkto: search terms imported from: moin--main--1.5--patch-254
author Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
date Tue, 29 Nov 2005 14:04:03 +0000
parents 763d15fbcdfc
children c0d66a781c44
files MoinMoin/search.py MoinMoin/support/lupy/search/boolean.py
diffstat 2 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/search.py	Sun Nov 27 15:39:27 2005 +0000
+++ b/MoinMoin/search.py	Tue Nov 29 14:04:03 2005 +0000
@@ -366,7 +366,7 @@
         @param use_re: treat pattern as re of plain text, bool
         @param case: do case sensitive search, bool 
         """
-        pattern = pattern.replace(" ", "_")
+        pattern = pattern.replace("_", " ")
         # used for search in links
         self._pattern = pattern
         # used for search in text
--- a/MoinMoin/support/lupy/search/boolean.py	Sun Nov 27 15:39:27 2005 +0000
+++ b/MoinMoin/support/lupy/search/boolean.py	Tue Nov 29 14:04:03 2005 +0000
@@ -5,7 +5,7 @@
 
 import itertools
 import similarity
-
+import traceback
 
 class BooleanQuery:
     """A Query that matches documents matching boolean combinations of
@@ -169,14 +169,17 @@
             # add bits in mask
             bucket[2] |= mask
             # increment coord
-            bucket[3] += 1
+            bucket[3] += 1 # XXX
+            #print doc, score, mask, bucket
 
             
     def score(self, maxDoc):
         if self.coordFactors is None:
             self.computeCoordFactors()
         for t in self.scorers:
+            #print "SCORER", t.scorer
             for d,score in t.scorer.score(maxDoc):
+                #print "DOCUMENT"
                 self.collect(d,score,t.mask)
         return self.collectHits()
     
@@ -186,7 +189,7 @@
             if (bits & self.prohibitedMask) == 0 and (bits & self.requiredMask) == self.requiredMask:
                 # if prohibited and required check out
                 # add to results
-                #print (doc, score * self.coordFactors[coord])
+                #print "CollectHits:", doc, score, self.coordFactors, coord
                 yield (doc, score * self.coordFactors[coord])
         del self.validList[:]