[Xapian-discuss] Get PositionList from the Mset

zhiguo li zhiguo.li at gmail.com
Wed Nov 12 22:13:20 GMT 2008


First of all, thanks for the quick reply.

I was trying to use the TermIterator to get the position list, but when I
tried it, I got the following error:

****************************************************************************************************

InvalidOperationError: VectorTermList::positionlist_begin() isn't meaningful

****************************************************************************************************

Actually I didn't expect it to work since I need to specify in which
document to get the PositionList. But when I called  t.positionlist_begin()
(suppose 't' is a TermIterator), I didn't specity which document to work on.

Is my reasoning correct? or I am totally lost?

p.s. I am trying to get the positional information so that I can re-rank the
MSet based on proximity scores to get hopefully better phrase search
results.

Thanks,

Kevin

On Wed, Nov 12, 2008 at 4:50 PM, James Aylett <james-xapian at tartarus.org>wrote:

> 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
>
> _______________________________________________
> Xapian-discuss mailing list
> Xapian-discuss at lists.xapian.org
> http://lists.xapian.org/mailman/listinfo/xapian-discuss
>


More information about the Xapian-discuss mailing list