[Xapian-devel] Composition of NEAR and OR

Olly Betts olly at survex.com
Wed Nov 15 20:53:28 GMT 2006


On Wed, Nov 15, 2006 at 09:24:55PM +0100, Jean-Francois Dockes wrote:
> Olly Betts writes:
>  > I'm not sure this flattening is really the best way to handle this -
>  > fixing NearPostList to handle non-LeafPostLists would be more efficient
>  > I think.  I think all that really needs is a PositionList subclass which
>  > can return (in order) all the positions in any of a list of
>  > PositionLists, which isn't too hard.
> 
> About the NearPostList code, I've tried to read phrasepostlist.cc, and
> there is one thing at least which I don't understand, which is
> how/when/whether the 'terms' postlists get positionned to the right
> document before read_position_list() is called for each (in
> phrasepostlist.cc, NearPostList::test_doc()).

What happens is that the PostList is positioned on each document which
matches an AND query, and then test_doc() is called.  See SelectPostList
(parent class of NearPostList and PhrasePostList) for where this
happens.

>  > However, you could try just returning from flatten_subqs if op isn't
>  > OP_NEAR or OP_PHRASE and see if that does the job.  Calling
>  > "get_description" on the restructured query should show if it worked
>  > or not.
> 
> I'll try this tomorrow (and have another pass at trying to understand the
> code now that I know it's not explicitely designed not to support this).

Cool.

Cheers,
    Olly



More information about the Xapian-devel mailing list