[Xapian-discuss] Howto use the term iterator?

John Wards jwards at whiteoctober.co.uk
Thu Oct 2 11:22:18 BST 2008


Hello,

I am scratching my head at how to use the term iterator in PHP.

I would like to know what terms are stored against a document. 

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();

I have tried foreaching on it and that doesn't work. I have tried using
reflection to see if I am missing something and found a "next" method.
But again I can't seem to get that to work either.

Some simple example code would be great!

I was only needing this for debugging a document and found "delve" which
does the job, but I don't like to be beaten on this one...

Cheers
John




More information about the Xapian-discuss mailing list