[Xapian-devel] Composition of NEAR and OR

Jean-Francois Dockes jean-francois.dockes at wanadoo.fr
Wed Nov 15 10:50:13 GMT 2006


The following piece of code triggers an 'unimplemented' exception with the
message:
 "Can't use NEAR/PHRASE with a subexpression containing NEAR or PHRASE"

      Xapian::Query or1(Xapian::Query::OP_OR, 
		    Xapian::Query("one"), 
		    Xapian::Query("two"));
      Xapian::Query or2(Xapian::Query::OP_OR, 
		    Xapian::Query("three"), 
		    Xapian::Query("four"));
      Xapian::Query near(Xapian::Query::OP_NEAR, or1, or2);

I can't decide by looking at the code in omqueryinternal.cc if this is
intentional or not. In debug mode, it does trigger the NEAR or PHRASE
assertion at the top of flatten_subqs(), which gets called at some point
for the query: 
    ((one NEAR 2 three) OR (one NEAR 2 four))

which does not seem right or needed, 

Is this "(x or y) near (z or t)" query supposed to work or not ? I'm
willing to try and fix it if it should work, but this area of the xapian
code certainly does not suffer from an excess of comments ...

Regards,

J.F. Dockes




More information about the Xapian-devel mailing list