org.apache.lucene.queryparser.flexible.core.nodes

## Class QueryNodeImpl

- java.lang.Object
- - org.apache.lucene.queryparser.flexible.core.nodes.QueryNodeImpl

- All Implemented Interfaces:
    Cloneable, QueryNode
  Direct Known Subclasses:
    AbstractRangeQueryNode, BooleanQueryNode, BoostQueryNode, DeletedQueryNode, FieldQueryNode, GroupQueryNode, LegacyNumericQueryNode, MatchAllDocsQueryNode, ModifierQueryNode, MultiPhraseQueryNode, OpaqueQueryNode, PathQueryNode, PhraseSlopQueryNode, PointQueryNode, RegexpQueryNode, SlopQueryNode, TokenizedPhraseQueryNode

      public abstract class QueryNodeImpl
      extends Object
      implements QueryNode, Cloneable

  A `QueryNodeImpl` is the default implementation of the interface `QueryNode`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `PLAINTEXT_FIELD_NAME`
    `protected boolean` | `toQueryStringIgnoreFields` If set to true the the method toQueryString will not write field names

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `QueryNodeImpl()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(List<QueryNode> children)`
    `void` | `add(QueryNode child)`
    `protected void` | `allocate()`
    `QueryNode` | `clone()`
    `QueryNode` | `cloneTree()` Recursive clone the QueryNode tree The tags are not copied to the new tree when you call the cloneTree() method
    `boolean` | `containsTag(String tagName)` verify if a node contains a tag
    `List<QueryNode>` | `getChildren()` get Children nodes
    `QueryNode` | `getParent()`
    `Object` | `getTag(String tagName)` Returns object stored under that tag name
    `Map<String,Object>` | `getTagMap()` Returns a map containing all tags attached to this query node.
    `protected boolean` | `isDefaultField(CharSequence fld)` This method is use toQueryString to detect if fld is the default field
    `boolean` | `isLeaf()` verify if a node is a Leaf node
    `protected boolean` | `isRoot()`
    `void` | `removeChildren(QueryNode childNode)` Remove a child node
    `void` | `removeFromParent()` Removes this query node from its parent.
    `void` | `set(List<QueryNode> children)`
    `protected void` | `setLeaf(boolean isLeaf)`
    `void` | `setTag(String tagName, Object value)` Associate the specified value with the specified tagName.
    `String` | `toString()` Every implementation of this class should return pseudo xml like this: For FieldQueryNode: <field start='1' end='2' field='subject' text='foo'/>
    `void` | `unsetTag(String tagName)` Unset a tag.

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

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

    - ### Methods inherited from interface org.apache.lucene.queryparser.flexible.core.nodes.QueryNode

      `toQueryString`

- - ### Field Detail

    - #### PLAINTEXT_FIELD_NAME

          public static final String PLAINTEXT_FIELD_NAME

      See Also:
        Constant Field Values

    - #### toQueryStringIgnoreFields

          protected boolean toQueryStringIgnoreFields

      If set to true the the method toQueryString will not write field names

  - ### Constructor Detail

    - #### QueryNodeImpl

          public QueryNodeImpl()

  - ### Method Detail

    - #### allocate

          protected void allocate()

    - #### add

          public final void add(QueryNode child)

      Specified by:
        `add` in interface `QueryNode`

    - #### add

          public final void add(List<QueryNode> children)

      Specified by:
        `add` in interface `QueryNode`

    - #### isLeaf

          public boolean isLeaf()

      Description copied from interface: `QueryNode`
      verify if a node is a Leaf node
      Specified by:
        `isLeaf` in interface `QueryNode`

    - #### set

          public final void set(List<QueryNode> children)

      Specified by:
        `set` in interface `QueryNode`

    - #### cloneTree

          public QueryNode cloneTree()
                              throws CloneNotSupportedException

      Description copied from interface: `QueryNode`
      Recursive clone the QueryNode tree The tags are not copied to the new tree when you call the cloneTree() method
      Specified by:
        `cloneTree` in interface `QueryNode`
      Returns:
        the cloned tree
      Throws:
        `CloneNotSupportedException`

    - #### clone

          public QueryNode clone()
                          throws CloneNotSupportedException

      Overrides:
        `clone` in class `Object`
      Throws:
        `CloneNotSupportedException`

    - #### setLeaf

          protected void setLeaf(boolean isLeaf)

    - #### getChildren

          public final List<QueryNode> getChildren()

      Description copied from interface: `QueryNode`
      get Children nodes
      Specified by:
        `getChildren` in interface `QueryNode`
      Returns:
        a List for QueryNode object. Returns null, for nodes that do not contain children. All leaf Nodes return null.

    - #### setTag

          public void setTag(String tagName,
                             Object value)

      Description copied from interface: `QueryNode`
      Associate the specified value with the specified tagName. If the tagName already exists, the old value is replaced. The tagName and value cannot be null. tagName will be converted to lowercase.
      Specified by:
        `setTag` in interface `QueryNode`

    - #### unsetTag

          public void unsetTag(String tagName)

      Description copied from interface: `QueryNode`
      Unset a tag. tagName will be converted to lowercase.
      Specified by:
        `unsetTag` in interface `QueryNode`

    - #### containsTag

          public boolean containsTag(String tagName)

      verify if a node contains a tag
      Specified by:
        `containsTag` in interface `QueryNode`

    - #### getTag

          public Object getTag(String tagName)

      Description copied from interface: `QueryNode`
      Returns object stored under that tag name
      Specified by:
        `getTag` in interface `QueryNode`

    - #### getParent

          public QueryNode getParent()

      Specified by:
        `getParent` in interface `QueryNode`

    - #### isRoot

          protected boolean isRoot()

    - #### isDefaultField

          protected boolean isDefaultField(CharSequence fld)

      This method is use toQueryString to detect if fld is the default field
      Parameters:
        `fld` - - field name
      Returns:
        true if fld is the default field

    - #### toString

          public String toString()

      Every implementation of this class should return pseudo xml like this: For FieldQueryNode: <field start='1' end='2' field='subject' text='foo'/>
      Specified by:
        `toString` in interface `QueryNode`
      Overrides:
        `toString` in class `Object`
      See Also:
        `QueryNode.toString()`

    - #### getTagMap

          public Map<String,Object> getTagMap()

      Returns a map containing all tags attached to this query node.
      Specified by:
        `getTagMap` in interface `QueryNode`
      Returns:
        a map containing all tags attached to this query node

    - #### removeChildren

          public void removeChildren(QueryNode childNode)

      Description copied from interface: `QueryNode`
      Remove a child node
      Specified by:
        `removeChildren` in interface `QueryNode`
      Parameters:
        `childNode` - Which child to remove

    - #### removeFromParent

          public void removeFromParent()

      Description copied from interface: `QueryNode`
      Removes this query node from its parent.
      Specified by:
        `removeFromParent` in interface `QueryNode`

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