Class BooleanQuery2ModifierNodeProcessor
java.lang.Object
org.apache.lucene.queryparser.flexible.standard.processors.BooleanQuery2ModifierNodeProcessor
- All Implemented Interfaces:
QueryNodeProcessor
This processor is used to apply the correct
ModifierQueryNode
to BooleanQueryNode
s children. This is a variant of BooleanModifiersQueryNodeProcessor
which ignores precedence.
The StandardSyntaxParser
knows the rules of precedence, but lucene does not. e.g.
(A AND B OR C AND D)
ist treated like (+A +B +C +D)
.
This processor walks through the query node tree looking for BooleanQueryNode
s. If an
AndQueryNode
is found, every child, which is not a ModifierQueryNode
or the
ModifierQueryNode
is ModifierQueryNode.Modifier.MOD_NONE
, becomes a ModifierQueryNode.Modifier.MOD_REQ
. For
default BooleanQueryNode
, it checks the default operator is StandardQueryConfigHandler.Operator.AND
, if it
is, the same operation when an AndQueryNode
is found is applied to it. Each BooleanQueryNode
which direct parent is also a BooleanQueryNode
is removed (to ignore
the rules of precedence).
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Returns theQueryConfigHandler
associated to the query tree if any, otherwise it returnsnull
protected boolean
isDefaultBooleanQueryNode
(QueryNode toTest) protected QueryNode
postProcessNode
(QueryNode node) protected QueryNode
preProcessNode
(QueryNode node) Processes a query node tree.protected void
processChildren
(QueryNode queryTree) void
setQueryConfigHandler
(QueryConfigHandler queryConfigHandler) Sets theQueryConfigHandler
associated to the query tree.protected void
-
Constructor Details
-
BooleanQuery2ModifierNodeProcessor
public BooleanQuery2ModifierNodeProcessor()
-
-
Method Details
-
process
Description copied from interface:QueryNodeProcessor
Processes a query node tree. It may return the same or another query tree. I should never returnnull
.- Specified by:
process
in interfaceQueryNodeProcessor
- Parameters:
queryTree
- tree root node- Returns:
- the processed query tree
- Throws:
QueryNodeException
-
processChildren
- Throws:
QueryNodeException
-
fillChildrenBufferAndApplyModifiery
-
postProcessNode
- Throws:
QueryNodeException
-
preProcessNode
- Throws:
QueryNodeException
-
isDefaultBooleanQueryNode
-
tagModifierButDoNotOverride
-
setQueryConfigHandler
Description copied from interface:QueryNodeProcessor
Sets theQueryConfigHandler
associated to the query tree.- Specified by:
setQueryConfigHandler
in interfaceQueryNodeProcessor
-
getQueryConfigHandler
Description copied from interface:QueryNodeProcessor
Returns theQueryConfigHandler
associated to the query tree if any, otherwise it returnsnull
- Specified by:
getQueryConfigHandler
in interfaceQueryNodeProcessor
- Returns:
- the
QueryConfigHandler
associated to the query tree if any, otherwise it returnsnull
-