changeset 5180:045d5788b82e

Xapian indexing: we need to return a UnprocessedDocument in any case, never a ProcessedDocument
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 04 Oct 2009 02:33:57 +0200
parents 506a24108050
children 5ce7455bd34b
files MoinMoin/search/Xapian/indexing.py
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/search/Xapian/indexing.py	Sat Oct 03 23:46:37 2009 +0200
+++ b/MoinMoin/search/Xapian/indexing.py	Sun Oct 04 02:33:57 2009 +0200
@@ -192,21 +192,24 @@
         connection.close()
 
     def _get_document(self, connection, doc_id, mtime, mode):
-        document = None
+        do_index = False
 
         if mode == 'update':
             try:
                 doc = connection.get_document(doc_id)
                 docmtime = long(doc.data['mtime'][0])
-                if mtime > docmtime:
-                    document = doc
             except KeyError:
-                document = xappy.UnprocessedDocument()
-                document.id = doc_id
+                do_index = True
+            else:
+                do_index = mtime > docmtime
         elif mode == 'add':
+            do_index = True
+
+        if do_index:
             document = xappy.UnprocessedDocument()
             document.id = doc_id
-
+        else:
+            document = None
         return document
 
     def _add_fields_to_document(self, request, document, fields=None, multivalued_fields=None):