[Xapian-discuss] TermIterator in python bindings causes segfault

Carsten Reimer
Mon, 29 Oct 2007 16:22:37 -0000

Hello,

I am using the Python (python 2.4.4 on Debian Etch) bindings of the
current stable Version of xapian (self-compiled). What I was trying to
achieve is to get all the terms that matched in a particular document of
an MSet. I do this as follows:

Take one MSet-item

Get the docid of the document that belongs to that MSet-item

call get_matching_terms_begin(docid) on the underlying Enquire-instance
to get a TermIterator

Iterate over that TermIterator using the next() method and get each term
by calling the get_term() method.

The outcome is a segmentation fault as soon as the last term was read.

I tried to figure out how to determine the number of terms in the
TermIterator I got by get_matching_terms_begin(docid) but I did not find
any way to do this. If I had that number I could easily stop the
iterator after the last term has been read.

Or is there any other way to stop the TermIterator from reading beyond
his last item?

Remember: I use the Python Bindings. (the effect is also valid for the
Debian package).

Every hint is warmly welcome.

Thanks in advance

with best regards

Carsten Reimer

--
Carsten Reimer
Webentwickler
carsten.reimer@galileo-press.de
Tel. +49.228.42150.73

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel. +49.228.42150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Gesch?ftsf?hrer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn