I've been making local changes to QueryParser to fix the operator precedence issues (i.e. currently A AND B OR C AND D parses to +A +B +C +D).

I've gotten every TestQueryParser test to pass without modification including this new one:

public void testPrecedence() throws Exception {
Query query1 = QueryParser.parse("A AND B OR C AND D", "field", new WhitespaceAnalyzer());
Query query2 = QueryParser.parse("(A AND B) OR (C AND D)", "field", new WhitespaceAnalyzer());
assertEquals(query1, query2);
}


except for this one from testQPA:

    assertQueryEquals("term AND NOT phrase term", qpAnalyzer,
                      "+term -\"phrase1 phrase2\" term");

The error I get is this:

junit.framework.AssertionFailedError: Query /term AND NOT phrase term/ yielded /(+term -"phrase1 phrase2") term/, expecting /+term -"phrase1 phrase2" term/

My take is that the test is asserting the incorrect behavior that we want to fix. Do others agree?

If we agree, then I'll adjust the test to expect /(+term -"phrase1 phrase2") term/ instead. The next steps will be:

- Rename my work to PrecedenceQueryParser.jj (name up for discussion if desired)
- Adjust the build file to take this new JavaCC file into account (I'm also switching back to using <javacc> and adding a <jjdoc> in to document the grammars we use).
- Deprecate our current QueryParser and refer users to the new PrecedenceQueryParser.


I'm switching back to <javacc> in the build as it works fine with JavaCC 3.2 and does dependency checking automatically. The only issue is that <javacc> currently only does dependency checking, such that if the .jj is newer than the generated .java file then generation is skipped - this makes it tricky to force generation. I'll also add a way to force generation by removing the generated .java file, and I'll also probably add a force="..." attribute to <javacc> since I'm also an Ant committer :) (to be present in Ant 1.6.3 hopefully). Any other <javacc> wishes out there?

Any thoughts on any of the above?

        Erik


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to