diff roundup/backends/indexer_xapian.py @ 5108:67fad01d2009

issue2550653: xapian search, stemming is not working This is a partial fix for the issue. It does make stemming work (so searching for silent will also return docs with silently in them). However to do this we need to lowercase the text so the porter stemmer will work. This means capitalization is not preserved. Tests in test/test_indexer for xapian backend all pass. David Wolever (wolever) did the work.
author John Rouillard <rouilj@ieee.org>
date Mon, 27 Jun 2016 22:10:45 -0400
parents 3ff1a288fb9c
children 93832cec4c31
line wrap: on
line diff
--- a/roundup/backends/indexer_xapian.py	Mon Jun 27 18:50:39 2016 -0400
+++ b/roundup/backends/indexer_xapian.py	Mon Jun 27 22:10:45 2016 -0400
@@ -82,7 +82,7 @@
             word = match.group(0)
             if self.is_stopword(word):
                 continue
-            term = stemmer(word)
+            term = stemmer(word.lower())
             doc.add_posting(term, match.start(0))
 
         database.replace_document(identifier, doc)
@@ -103,7 +103,7 @@
         for term in [word.upper() for word in wordlist
                           if self.minlength <= len(word) <= self.maxlength]:
             if not self.is_stopword(term):
-                terms.append(stemmer(term))
+                terms.append(stemmer(term.lower()))
         query = xapian.Query(xapian.Query.OP_AND, terms)
 
         enquire.set_query(query)

Roundup Issue Tracker: http://roundup-tracker.org/