[Xapian-discuss] allterms() in Python

James Aylett
Thu, 23 Nov 2006 15:40:16 -0000

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 supported

ISTR 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