org.apache.lucene.queryparser.flexible.standard.processors

## 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 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).

  See Also:
    `StandardQueryConfigHandler.ConfigurationKeys.DEFAULT_OPERATOR`, `BooleanModifiersQueryNodeProcessor`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BooleanQuery2ModifierNodeProcessor()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `fillChildrenBufferAndApplyModifiery(QueryNode parent)`
    `QueryConfigHandler` | `getQueryConfigHandler()` Returns the `QueryConfigHandler` associated to the query tree if any, otherwise it returns `null`
    `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 the `QueryConfigHandler` associated to the query tree.
    `protected void` | `tagModifierButDoNotOverride(QueryNode node, ModifierQueryNode.Modifier mod)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### BooleanQuery2ModifierNodeProcessor

          public BooleanQuery2ModifierNodeProcessor()

  - ### 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 return `null`.
      Specified by:
        `process` in interface `QueryNodeProcessor`
      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 the `QueryConfigHandler` associated to the query tree.
      Specified by:
        `setQueryConfigHandler` in interface `QueryNodeProcessor`

    - #### getQueryConfigHandler

          public QueryConfigHandler getQueryConfigHandler()

      Description copied from interface: `QueryNodeProcessor`
      Returns the `QueryConfigHandler` associated to the query tree if any, otherwise it returns `null`
      Specified by:
        `getQueryConfigHandler` in interface `QueryNodeProcessor`
      Returns:
        the `QueryConfigHandler` associated to the query tree if any, otherwise it returns `null`

Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.