Class BooleanQuery2ModifierNodeProcessor
- java.lang.Object
-
- org.apache.lucene.queryparser.flexible.standard.processors.BooleanQuery2ModifierNodeProcessor
-
- All Implemented Interfaces:
QueryNodeProcessor
public class BooleanQuery2ModifierNodeProcessor extends java.lang.Object implements QueryNodeProcessor
This processor is used to apply the correct
ModifierQueryNodetoBooleanQueryNodes children. This is a variant ofBooleanModifiersQueryNodeProcessorwhich ignores precedence.The
StandardSyntaxParserknows 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
BooleanQueryNodes. If anAndQueryNodeis found, every child, which is not aModifierQueryNodeor theModifierQueryNodeisModifierQueryNode.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 anAndQueryNodeis found is applied to it. EachBooleanQueryNodewhich direct parent is also aBooleanQueryNodeis 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 QueryConfigHandlergetQueryConfigHandler()Returns theQueryConfigHandlerassociated to the query tree if any, otherwise it returnsnullQueryNodeprocess(QueryNode queryTree)Processes a query node tree.voidsetQueryConfigHandler(QueryConfigHandler queryConfigHandler)Sets theQueryConfigHandlerassociated to the query tree.
-
-
-
Method Detail
-
process
public QueryNode process(QueryNode queryTree) throws QueryNodeException
Description copied from interface:QueryNodeProcessorProcesses a query node tree. It may return the same or another query tree. I should never returnnull.- Specified by:
processin interfaceQueryNodeProcessor- Parameters:
queryTree- tree root node- Returns:
- the processed query tree
- Throws:
QueryNodeException
-
setQueryConfigHandler
public void setQueryConfigHandler(QueryConfigHandler queryConfigHandler)
Description copied from interface:QueryNodeProcessorSets theQueryConfigHandlerassociated to the query tree.- Specified by:
setQueryConfigHandlerin interfaceQueryNodeProcessor
-
getQueryConfigHandler
public QueryConfigHandler getQueryConfigHandler()
Description copied from interface:QueryNodeProcessorReturns theQueryConfigHandlerassociated to the query tree if any, otherwise it returnsnull- Specified by:
getQueryConfigHandlerin interfaceQueryNodeProcessor- Returns:
- the
QueryConfigHandlerassociated to the query tree if any, otherwise it returnsnull
-
-