FAQ
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

Search Discussions

  • Olly Betts at Oct 29, 2007 at 4:44 pm

    On Mon, Oct 29, 2007 at 05:21:44PM +0100, Carsten Reimer wrote:
    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.
    Compare it to the result of get_matching_terms_end(docid).

    However, I'd recommend using the "Pythonic" iterators. See the
    documentation of the Python bindings for details.

    Cheers,
    Olly

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupxapian-discuss @
categoriesxapian
postedOct 29, '07 at 4:21p
activeOct 29, '07 at 4:44p
posts2
users2
websitexapian.org
irc#xapian

2 users in discussion

Olly Betts: 1 post Carsten Reimer: 1 post

People

Translate

site design / logo © 2022 Grokbase