[Xapian-discuss] PHP XapianTermIterator/XapianPositionIterator usage

Graham Kann graham.kann at gmail.com
Sat Jan 16 10:04:38 GMT 2010


Hello again,

/thanks to Peter for previous response.

I've been digging around trying to find sample usage of
XapianTermIterator/XapianPositionIterator in PHP.  The idea is to code up a
test case in PHP to perform snippet extraction (with a possible view to
coding a pecl extension in C).   I found a C++ sample, but that wasn't much
help.

I must be dense this morning though, since I can't get my head around how to
use XapianTermIterator to step through the terms, and to iterate through all
the positions of each term with XapianPositionIterator.

Can someone provide a basic PHP example of how to:

//pseudo code
$position_iterator = new XapianPositionIterator();
$term_iterator     = new XapianTermIterator();

foreach $term ($position_iterator)
    foreach $position ($term_iterator($term))
...


Any assistance would be appreciated.

Thanks


More information about the Xapian-discuss mailing list