Class BooleanQuery2ModifierNodeProcessor
- java.lang.Object
-
- org.apache.lucene.queryparser.flexible.standard.processors.BooleanQuery2ModifierNodeProcessor
-
- All Implemented Interfaces:
QueryNodeProcessor
public class BooleanQuery2ModifierNodeProcessor extends Object implements QueryNodeProcessor
This processor is used to apply the correctModifierQueryNode
toBooleanQueryNode
s children. This is a variant ofBooleanModifiersQueryNodeProcessor
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 anAndQueryNode
is found, every child, which is not aModifierQueryNode
or theModifierQueryNode
isModifierQueryNode.Modifier.MOD_NONE
, becomes aModifierQueryNode.Modifier.MOD_REQ
. For defaultBooleanQueryNode
, it checks the default operator isStandardQueryConfigHandler.Operator.AND
, if it is, the same operation when anAndQueryNode
is found is applied to it. EachBooleanQueryNode
which direct parent is also aBooleanQueryNode
is removed (to ignore the rules of precedence).
-
-
Constructor Summary
Constructors Constructor Description BooleanQuery2ModifierNodeProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
fillChildrenBufferAndApplyModifiery(QueryNode parent)
QueryConfigHandler
getQueryConfigHandler()
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)
QueryNode
process(QueryNode queryTree)
Processes a query node tree.protected void
processChildren(QueryNode queryTree)
void
setQueryConfigHandler(QueryConfigHandler queryConfigHandler)
Sets theQueryConfigHandler
associated to the query tree.protected void
tagModifierButDoNotOverride(QueryNode node, ModifierQueryNode.Modifier mod)
-
-
-
Method Detail
-
process
public QueryNode process(QueryNode queryTree) throws QueryNodeException
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
protected void processChildren(QueryNode queryTree) throws QueryNodeException
- Throws:
QueryNodeException
-
fillChildrenBufferAndApplyModifiery
protected void fillChildrenBufferAndApplyModifiery(QueryNode parent)
-
postProcessNode
protected QueryNode postProcessNode(QueryNode node) throws QueryNodeException
- Throws:
QueryNodeException
-
preProcessNode
protected QueryNode preProcessNode(QueryNode node) throws QueryNodeException
- Throws:
QueryNodeException
-
isDefaultBooleanQueryNode
protected boolean isDefaultBooleanQueryNode(QueryNode toTest)
-
tagModifierButDoNotOverride
protected void tagModifierButDoNotOverride(QueryNode node, ModifierQueryNode.Modifier mod)
-
setQueryConfigHandler
public void setQueryConfigHandler(QueryConfigHandler queryConfigHandler)
Description copied from interface:QueryNodeProcessor
Sets theQueryConfigHandler
associated to the query tree.- Specified by:
setQueryConfigHandler
in interfaceQueryNodeProcessor
-
getQueryConfigHandler
public QueryConfigHandler 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
-
-