changeset 1337:3b1de2b38587

search/indexing: enable the query parser RegexPlugin, remove a workaround for a fixed whoosh issue
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 21 Apr 2012 20:52:12 +0200
parents b8652b85a5fa
children 76bdeccacb4d
files MoinMoin/storage/middleware/indexing.py
diffstat 1 files changed, 2 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/storage/middleware/indexing.py	Sat Apr 21 20:04:20 2012 +0200
+++ b/MoinMoin/storage/middleware/indexing.py	Sat Apr 21 20:52:12 2012 +0200
@@ -391,11 +391,7 @@
                     itemid = searcher.stored_fields(docnum_remove)[ITEMID]
             if docnum_remove is not None:
                 # we are removing a revid that is in latest revs index
-                try:
-                    latest_names_revids = self._find_latest_names_revids(self.ix[ALL_REVS], Term(ITEMID, itemid))
-                except AttributeError:
-                    # workaround for bug #200 AttributeError: 'FieldCache' object has no attribute 'code'
-                    latest_names_revids = []
+                latest_names_revids = self._find_latest_names_revids(self.ix[ALL_REVS], Term(ITEMID, itemid))
                 if latest_names_revids:
                     # we have a latest revision, just update the document in the index:
                     assert len(latest_names_revids) == 1 # this item must have only one latest revision
@@ -580,8 +576,7 @@
             qp = QueryParser(default_fields[0], schema=schema)
         else:
             raise ValueError("default_fields list must at least contain one field name")
-        # TODO before using the RegexPlugin, require a whoosh release that fixes whoosh issues #205 and #206
-        #qp.add_plugin(RegexPlugin())
+        qp.add_plugin(RegexPlugin())
         def username_pseudo_field(node):
             username = node.text
             users = user.search_users(**{NAME_EXACT: username})