changeset 3691:a5e33ae8f469

fix xapian search for '-a or b' query (see also 3669:0cbd8b41aebd), tests broken
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 08 Jun 2008 23:30:10 +0200
parents 54e654507222
children 02a602f955f6
files MoinMoin/search/queryparser.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/search/queryparser.py	Sun Jun 08 20:50:04 2008 +0200
+++ b/MoinMoin/search/queryparser.py	Sun Jun 08 23:30:10 2008 +0200
@@ -955,8 +955,9 @@
                         if last.__class__ == OrExpression:
                             orexpr = last
                         else:
-                            if len(sub) == 1:
-                                terms = sub[0]
+                            # Note: do NOT reduce "terms" when it has a single subterm only!
+                            # Doing that would break "-someterm" searches as we rely on AndExpression
+                            # doing a "MatchAll AND_NOT someterm" for that case!
                             orexpr = OrExpression(terms)
                         terms = AndExpression(orexpr)
                     remaining = self._analyse_items(items)