[Xapian-devel] Composition of NEAR and OR
jean-francois.dockes at wanadoo.fr
Thu Nov 16 12:38:22 GMT 2006
Olly Betts writes:
> 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
Because the "source" and "terms" postlists are references to an AndPostlist
and its components, the "terms" lists get positionned automagically when
next() is called on source ? Or what ? :)
I think that I have fixed the NEAR distribution code. It's probably not
optimal but it seems to work for me.
The trick as I see it was that flatten_subqs() must not be called
resursively on the object itself *which is not a NEAR query* anymore after
the first transformation.
flatten_subqs() is called on each of the subqueries instead, after the
I have a patch against the 0.9 svn branch which is mostly comments. I also
left in place the two tracing fprintf() calls (which you'll probably want to
remove before possibly committing), just in case you want to see the thing
There is also a small program with a few test cases.
Here are both links (can't remember if this list accepts attachments...):
More information about the Xapian-devel