From: ber Date: Mon, 28 Jun 2010 12:52:10 +0000 (+0000) Subject: - Indexer Xapian, made Xapian 1.2 compatible. Needs at least Xapian 1.0.0 now. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=578a067f906ea62eb0f121e0f4dc809a3c30b69d;p=roundup.git - 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.) git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4484 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/CHANGES.txt b/CHANGES.txt index 29bb127..8ff2df4 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -13,6 +13,8 @@ Fixed: - Default to "text/plain" if no Content-Type header is present in email (thanks Hauke Duden) - Small documentation update regarding debugging aids (Bernhard Reiter) +- 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.) 2010-02-23 1.5.0 diff --git a/doc/installation.txt b/doc/installation.txt index d3cdf8e..2175318 100644 --- a/doc/installation.txt +++ b/doc/installation.txt @@ -69,9 +69,7 @@ Xapian full-text indexer installed and used. You will need to run the "roundup-admin reindex" command if the tracker has existing data. - Roundup requires Xapian *newer* than 0.9.2 - it may be necessary for - you to install a snapshot. Snapshot "0.9.2_svn6532" has been tried - successfully. + Roundup requires Xapian 1.0.0 or newer. pyopenssl If pyopenssl_ is installed the roundup-server can be configured @@ -85,7 +83,7 @@ pyme configured, you can require email to be cryptographically signed before roundup will allow it to make modifications to issues. -.. _Xapian: http://www.xapian.org/ +.. _Xapian: http://xapian.org/ .. _pytz: http://www.python.org/pypi/pytz .. _Olson tz database: http://www.twinsun.com/tz/tz-link.htm .. _pyopenssl: http://pyopenssl.sourceforge.net diff --git a/roundup/backends/indexer_xapian.py b/roundup/backends/indexer_xapian.py index 38a7f2e..385bcae 100644 --- a/roundup/backends/indexer_xapian.py +++ b/roundup/backends/indexer_xapian.py @@ -24,7 +24,6 @@ class Indexer(IndexerBase): '''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 @@ class Indexer(IndexerBase): 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 @@ class Indexer(IndexerBase): # 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 @@ class Indexer(IndexerBase): 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