On Wed, Nov 12, 2008 at 04:27:14PM -0500, zhiguo li wrote:
> I used the MSetIterator to get Docids from the MSet, and from the query I
> can get the query terms by query.get_terms_begin(). Now I have the query
> terms and DocIDs, questions is how to get the positional information?
Given a TermIterator, you can use positionlist_begin() to get a
PositionIterator, which will give you the position list within the
relevant document for the current term of the TermIterator.
You can use Enquire::get_matching_terms(MSetIterator&) to get a
TermIterator; this will iterate over only the terms in the current
query which actually match the current document. (Current in the sense
of the MSetIterator.)
I believe, but haven't checked, that this will do what you want.
J
--
/--------------------------------------------------------------------------\
James Aylett xapian.org
james at tartarus.org uncertaintydivision.org