[Xapian-discuss] PHP termpos issue

Olly Betts olly at survex.com
Thu Aug 23 18:55:23 BST 2007

On Sun, Aug 19, 2007 at 10:53:18PM -0500, Mike Ragalie wrote:
> I just started playing around with Xapian using the php bindings and am
> having some trouble getting the term positions for terms returned by a
> query.
> [snip]
> When I run the script, I get this: "InvalidOperationError:
> VectorTermList::positionlist_begin() isn't meaningful"

This isn't supported (at the C++ level).

It's unclear to me what the most natural semantics would be.  It
wouldn't be too hard for it just to return all the positions at which
the term occurred, but perhaps it's more natural for it to return the
positions which were relevant to the query run (so for a phrase search
it would only show where the the term matched as part of the phrase).
That's not something we currently know, so we'd have to write the code
to work this out.

> I tried using $database->positionlist_begin($curdoc->get_docid(), $curterm)
> as well, but when I used that the while loop simply didn't run.

That should work if you want all the positions.  It's hard to say why
it didn't for you without seeing the code you had.  Here's a post with
some suitable C++ code if that helps:



More information about the Xapian-discuss mailing list