xapian_db is a WriteableDatbase. If I do this ...
for term in xapian_db.allterms():
pass
I get this error ...
Traceback (most recent call last):
File "./xapdex.py", line 274, in ?
check_removed_docs(xapian_db)
File "./xapdex.py", line 254, in check_removed_docs
for term in xapian_db.allterms():
File "/usr/lib/python2.4/site-packages/xapian.py", line 864, in next
r = [self.iter.get_term(), self.iter.get_wdf(), self.iter.get_termfreq(),
PositionIter(self.iter.positionlist_begin(), self.iter.positionlist_end())]
File "/usr/lib/python2.4/site-packages/xapian.py", line 169, in
positionlist_begin
def positionlist_begin(*args): return
_xapian.TermIterator_positionlist_begin(*args)
RuntimeError: InvalidOperationError: positionlist_begin not supported
Using the iterators works fine:
t = xapian_db.allterms_begin()
while t != xapian_db.allterms_end():
t.next()
I'd prefer the more Python syntax, which works fine for msets.
I'm using libxapian13 0.9.9-1.99edgy on Ubuntu.
Francis
On Thu, Nov 23, 2006 at 09:56:15AM -0500, Francis Irving wrote:> xapian_db is a WriteableDatbase. If I do this ... > > for term in xapian_db.allterms(): > pass > > I get this error ... > > Traceback (most recent call last): > File "./xapdex.py", line 274, in ? > check_removed_docs(xapian_db) > File "./xapdex.py", line 254, in check_removed_docs > for term in xapian_db.allterms(): > File "/usr/lib/python2.4/site-packages/xapian.py", line 864, in next > r = [self.iter.get_term(), self.iter.get_wdf(), self.iter.get_termfreq(), PositionIter(self.iter.positionlist_begin(), self.iter.positionlist_end())] > File "/usr/lib/python2.4/site-packages/xapian.py", line 169, in positionlist_begin > def positionlist_begin(*args): return _xapian.TermIterator_positionlist_begin(*args) > RuntimeError: InvalidOperationError: positionlist_begin not supportedISTR that allterms can't grab positional information. SVN has code to get this right (that Olly must have added, because it looks nothing like my python style :-). Can you find your TermIter definition in xapian.py and post it to the list? J -- /--------------------------------------------------------------------------\ James Aylett xapian.org james@tartarus.org uncertaintydivision.org
On Thu, Nov 23, 2006 at 09:56:15AM -0500, Francis Irving wrote:> xapian_db is a WriteableDatbase. If I do this ... > > for term in xapian_db.allterms(): > pass > > I get this error ...[...]> I'm using libxapian13 0.9.9-1.99edgy on Ubuntu.I think you must be accidentally using an older installation on the bindings somehow. This bug was fixed in 0.9.5, and there's a test in smoketest.py which is just like yours except it does something in the loop. Since debian/rules (which builds the packages) runs "make check" I can't see how this can have regressed.> Traceback (most recent call last): > File "./xapdex.py", line 274, in ? > check_removed_docs(xapian_db) > File "./xapdex.py", line 254, in check_removed_docs > for term in xapian_db.allterms(): > File "/usr/lib/python2.4/site-packages/xapian.py", line 864, in nextIn 0.9.9, xapian.py only has 734 lines... What's the first line of /usr/lib/python2.4/site-packages/xapian.py? It should say it is generated by SWIG 1.3.30. Cheers, Olly