diff roundup/backends/indexer_xapian.py @ 4378:477f2a47cbca

- Indexer Xapian, made Xapian 1.2 compatible. Needs at least Xapian 1.0.0 now. (Bernhard Reiter; Thanks to Olly Betts for providing the patch Issue2550647.)
author Bernhard Reiter <Bernhard.Reiter@intevation.de>
date Mon, 28 Jun 2010 12:52:10 +0000
parents 2ff6f39aa391
children 21a95ba01a42
line wrap: on
line diff
--- a/roundup/backends/indexer_xapian.py	Mon May 10 07:08:11 2010 +0000
+++ b/roundup/backends/indexer_xapian.py	Mon Jun 28 12:52:10 2010 +0000
@@ -24,7 +24,6 @@
         '''Save the changes to the index.'''
         if not self.transaction_active:
             return
-        # XXX: Xapian databases don't actually implement transactions yet
         database = self._get_database()
         database.commit_transaction()
         self.transaction_active = False
@@ -36,7 +35,6 @@
     def rollback(self):
         if not self.transaction_active:
             return
-        # XXX: Xapian databases don't actually implement transactions yet
         database = self._get_database()
         database.cancel_transaction()
         self.transaction_active = False
@@ -59,7 +57,9 @@
 
         # open the database and start a transaction if needed
         database = self._get_database()
-        # XXX: Xapian databases don't actually implement transactions yet
+
+        # XXX: Xapian now supports transactions, 
+        #  but there is a call to save_index() missing.
         #if not self.transaction_active:
             #database.begin_transaction()
             #self.transaction_active = True
@@ -77,9 +77,8 @@
         query = xapian.Query(xapian.Query.OP_AND, [identifier])
         enquire.set_query(query)
         matches = enquire.get_mset(0, 10)
-        if matches.size():      # would it killya to implement __len__()??
-            b = matches.begin()
-            docid = b.get_docid()
+        if len(matches):
+            docid = matches[0].docid
         else:
             docid = None
 

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