Skip to content

Commit 20d0003

Browse files
Bernhard ReiterBernhard Reiter
authored andcommitted
- 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.)
1 parent 90d7b4d commit 20d0003

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Fixed:
1313
- Default to "text/plain" if no Content-Type header is present in email
1414
(thanks Hauke Duden)
1515
- Small documentation update regarding debugging aids (Bernhard Reiter)
16+
- Indexer Xapian, made Xapian 1.2 compatible. Needs at least Xapian 1.0.0 now.
17+
(Bernhard Reiter; Thanks to Olly Betts for providing the patch Issue2550647.)
1618

1719

1820
2010-02-23 1.5.0

doc/installation.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ Xapian full-text indexer
6969
installed and used. You will need to run the "roundup-admin reindex"
7070
command if the tracker has existing data.
7171

72-
Roundup requires Xapian *newer* than 0.9.2 - it may be necessary for
73-
you to install a snapshot. Snapshot "0.9.2_svn6532" has been tried
74-
successfully.
72+
Roundup requires Xapian 1.0.0 or newer.
7573

7674
pyopenssl
7775
If pyopenssl_ is installed the roundup-server can be configured
@@ -85,7 +83,7 @@ pyme
8583
configured, you can require email to be cryptographically signed
8684
before roundup will allow it to make modifications to issues.
8785

88-
.. _Xapian: http://www.xapian.org/
86+
.. _Xapian: http://xapian.org/
8987
.. _pytz: http://www.python.org/pypi/pytz
9088
.. _Olson tz database: http://www.twinsun.com/tz/tz-link.htm
9189
.. _pyopenssl: http://pyopenssl.sourceforge.net

roundup/backends/indexer_xapian.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ def save_index(self):
2424
'''Save the changes to the index.'''
2525
if not self.transaction_active:
2626
return
27-
# XXX: Xapian databases don't actually implement transactions yet
2827
database = self._get_database()
2928
database.commit_transaction()
3029
self.transaction_active = False
@@ -36,7 +35,6 @@ def close(self):
3635
def rollback(self):
3736
if not self.transaction_active:
3837
return
39-
# XXX: Xapian databases don't actually implement transactions yet
4038
database = self._get_database()
4139
database.cancel_transaction()
4240
self.transaction_active = False
@@ -59,7 +57,9 @@ def add_text(self, identifier, text, mime_type='text/plain'):
5957

6058
# open the database and start a transaction if needed
6159
database = self._get_database()
62-
# XXX: Xapian databases don't actually implement transactions yet
60+
61+
# XXX: Xapian now supports transactions,
62+
# but there is a call to save_index() missing.
6363
#if not self.transaction_active:
6464
#database.begin_transaction()
6565
#self.transaction_active = True
@@ -77,9 +77,8 @@ def add_text(self, identifier, text, mime_type='text/plain'):
7777
query = xapian.Query(xapian.Query.OP_AND, [identifier])
7878
enquire.set_query(query)
7979
matches = enquire.get_mset(0, 10)
80-
if matches.size(): # would it killya to implement __len__()??
81-
b = matches.begin()
82-
docid = b.get_docid()
80+
if len(matches):
81+
docid = matches[0].docid
8382
else:
8483
docid = None
8584

0 commit comments

Comments
 (0)