[Xapian-discuss] Howto use the term iterator?

Olly Betts olly at survex.com
Thu Oct 2 12:08:45 BST 2008


On Thu, Oct 02, 2008 at 11:22:18AM +0100, John Wards wrote:
> I have a document called $odoc like so coming from some matches.
> 
> $i = $matches->begin();
> while (!$i->equals($matches->end())) {
>    $n = $i->get_rank() + 1;
>    $odoc = $i->get_document();
>    $data = $odoc->get_data();
>    $i->next();
> }
> 
> How do I use the termiterator returned from:
> 
> $odoc->termlist_begin();

Almost exactly as you're using the MSetIterator $i above, but the method
to read the term is get_term() not get_document().  There's more
information here:

http://xapian.org/docs/bindings/php/

> I have tried foreaching on it and that doesn't work.

It would be nice if this worked, but nobody's written the wrappers
required to implement it yet.

Cheers,
    Olly



More information about the Xapian-discuss mailing list