changeset 798:b83409e4570f

do not use xapian search with regex (AND would be no problem, but OR)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Wed, 03 May 2006 22:50:16 +0200
parents 89c724b4de15
children 28de47f4ff1a
files MoinMoin/search.py
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/search.py	Wed May 03 00:05:04 2006 +0200
+++ b/MoinMoin/search.py	Wed May 03 22:50:16 2006 +0200
@@ -166,6 +166,12 @@
             
         return '|'.join(result)
 
+    def xapian_wanted(self):
+        wanted = True
+        for term in self._subterms:
+            wanted = wanted and term.xapian_wanted()
+        return wanted
+
     def xapian_term(self):
         return "(%s)" % " AND ".join([term.xapian_term() for term in self._subterms])
 
@@ -247,6 +253,9 @@
             # XXX why not return None or empty list?
             return [Match()]
 
+    def xapian_wanted(self):
+        return not self.use_re
+
     def xapian_term(self):
         if self.use_re:
             return '' # xapian can't do regex search
@@ -311,6 +320,9 @@
             # XXX why not return None or empty list?
             return [Match()]
 
+    def xapian_wanted(self):
+        return not self.use_re
+
     def xapian_term(self):
         if self.use_re:
             return '' # xapian doesn't support regex search
@@ -398,6 +410,9 @@
             # XXX why not return None or empty list?
             return [Match()]
 
+    def xapian_wanted(self):
+        return not self.use_re
+
     def xapian_term(self):
         pattern = self.pattern
         if self.use_re:
@@ -1192,7 +1207,7 @@
         """
         pages = None
         index = Xapian.Index(self.request)
-        if index.exists():
+        if index.exists() and self.query.xapian_wanted():
             self.request.clock.start('_xapianSearch')
             try:
                 from MoinMoin.support import xapwrap