changeset 3570:eb5c6f776bce

xapian_stemming: removed some strange code (fixes search title:lowercaseword with xapian_stemming enabled)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 09 May 2008 01:29:10 +0200
parents 7593b6b4590c
children 35cd758720e8
files MoinMoin/search/queryparser.py
diffstat 1 files changed, 2 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/search/queryparser.py	Thu May 08 13:17:52 2008 +0200
+++ b/MoinMoin/search/queryparser.py	Fri May 09 01:29:10 2008 +0200
@@ -331,24 +331,7 @@
         # Search in page body
         body = page.get_raw_body()
         for match in self.search_re.finditer(body):
-            if page.request.cfg.xapian_stemming: # XXX if True fails fulltext searches for "bcd" if there is content "abcd"
-                # somewhere in regular word
-                if body[match.start()] not in config.chars_upper and \
-                        body[match.start()-1] in config.chars_lower:
-                    continue
-
-                post = 0
-                # XXX only do this for stemmd words. how?
-                #for c in body[match.end():]:
-                #    if c in config.chars_lower:
-                #        post += 1
-                #    else:
-                #        break
-
-                matches.append(TextMatch(start=match.start(),
-                        end=match.end()+post))
-            else:
-                matches.append(TextMatch(re_match=match))
+            matches.append(TextMatch(re_match=match))
 
         # Decide what to do with the results.
         if self.negated:
@@ -452,25 +435,7 @@
         logging.debug("TitleSearch searching page %r for (negated = %r) %r" % (page.page_name, self.negated, self._pattern))
         matches = []
         for match in self.search_re.finditer(page.page_name):
-            if page.request.cfg.xapian_stemming: # XXX if True this fails title searches for "foo" even if there is a page "foo"
-                # somewhere in regular word
-                if not self.case and \
-                        page.page_name[match.start()] not in config.chars_upper and \
-                        page.page_name[match.start()-1] in config.chars_lower:
-                    continue
-
-                post = 0
-                # XXX only do this for stemmd words. how?
-                #for c in page.page_name[match.end():]:
-                #    if c in config.chars_lower:
-                #        post += 1
-                #    else:
-                #        break
-
-                matches.append(TitleMatch(start=match.start(),
-                        end=match.end()+post))
-            else:
-                matches.append(TitleMatch(re_match=match))
+            matches.append(TitleMatch(re_match=match))
 
         if self.negated:
             if matches: