[ 
https://issues.apache.org/jira/browse/LUCENE-4109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13415341#comment-13415341
 ] 

Karsten R. commented on LUCENE-4109:
------------------------------------

Robert, the bug is in GroupQueryNodeProcessor:

StandardQueryTreeBuilder does not care about AndQueryNode or OrQueryNode, it 
expects to find the correct ModifierQueryNode-children.
GroupQueryNodeProcessor is responsible to insert this children 
(BooleanModifiersQueryNodeProcessor is not used in 
StandardQueryNodeProcessorPipeline).
But GroupQueryNodeProcessor does not support a proper recursion: You can hide a 
GroupQueryNode as child of AndQueryNodes or NOT-Nodes or Boost-Nodes.
So all in all this tests failed because "(a AND b)" is treated like "(a b)":
* assertQueryEquals("!(a AND b) OR c", null, "-(+a +b) c");
* assertQueryEquals("!(a AND b) AND c", null, "-(+a +b) +c");
* assertQueryEquals("((a AND b) AND c)", null, "(+a +b) +c");
* assertQueryEquals("(a AND b) AND c", null, "(+a +b) +c");
* {{{assertQueryEquals("!(a AND b)", null, "!(+a +b)");}}}
* assertQueryEquals("(a AND b)^4 OR c", null, "(+a +b)^4 c");

imho GroupQueryNodeProcessor should be divided in two processors. On processor 
to remove all GroupQueryNodes and one like BooleanModifiersQueryNodeProcessor 
to add ModifiersQueryNodes.
btw: If GroupQueryNodeProcessor would extends QueryNodeProcessorImpl we could 
be sure about the recursion.
                
> BooleanQueries are not parsed correctly with the flexible query parser
> ----------------------------------------------------------------------
>
>                 Key: LUCENE-4109
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4109
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: modules/queryparser
>    Affects Versions: 3.5, 3.6
>            Reporter: Daniel Truemper
>             Fix For: 4.0
>
>         Attachments: test-patch.txt
>
>
> Hi,
> I just found another bug in the flexible query parser (together with Robert 
> Muir, yay!).
> The following query string works in the standard query parser:
> {noformat}
> (field:[1 TO *] AND field:[* TO 2]) AND field2:z
> {noformat}
> yields
> {noformat}
> +(+field:[1 TO *] +field:[* TO 2]) +field2:z
> {noformat}
> The flexible query parser though yields:
> {noformat}
> +(field:[1 TO *] field:[* TO 2]) +field2:z
> {noformat}
> Test patch is attached (from Robert actually).
> I don't know if it affects earlier versions than 3.5.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to