[Xapian-discuss] RE : PHP XapianTermIterator/XapianPositionIterator usage

James Aylett james-xapian at tartarus.org
Tue Jan 19 12:31:32 GMT 2010


On 18 Jan 2010, at 10:53, Menard, Daniel wrote:

> But, I think that you're missing a level: you can iterate all terms from
> the database (termlist), you can get all documents ID for a particuliar
> term (postings) and then get all positions of this term in this
> document, but AFAIK you can't get directly all positions for a term.

To confirm that this is true; you need to run over the posting list for a term, and within that (supported directly on the PostingIterator) you run through the positions for that term in the document that PostingIterator is currently on.

It would only be a convenience to have an iterator for a term that ran through the tuples (docid, termpos), and if your algorithm needs to do anything even vaguely tree-like (keeping per-document information, for instance), it's easier to use things as they stand. You could always write a convenience function to do this for you, of course.

J


More information about the Xapian-discuss mailing list