NegationNode
@ExperimentalAppSearchApi
class NegationNode : Node
Node that stores a child node to be logically negated with a negative sign ("-") or 'NOT'.
The child node stored in this node will be negated in a query search, which means search will return all documents that do not match the sub-expression represented by the child node. For example, if the child node is a TextNode containing "foo", the resulting node will be treated as the query `-foo` or alternatively `NOT foo`.
This node should correspond to `(NOT WS | MINUS) simple` in Google AIP EBNF Filtering Definition.
This API may change in response to feedback and additional changes.
Summary
Public constructors |
|---|
NegationNode(childNode: Node)Constructor for a |
Public functions |
|
|---|---|
Boolean |
|
Node |
getChild()Retrieve the child node of this Node. |
(Mutable)List<Node!> |
Retrieve the child node of this Node as a list containing the only child node. |
Int |
hashCode() |
Unit |
Set the child node that the |
String |
toString()Get the string representation of |
Public constructors
NegationNode
NegationNode(childNode: Node)
Constructor for a NegationNode that takes in a child node of any Node type.
The resulting NegationNode represents the logical negation of its child node. For example if the child node represents `foo AND bar` then the resulting NegationNode represents `-(foo AND bar)` or alternatively `NOT (foo AND bar)`
This constructor is NOT a copy constructor. Passing in a NegationNode will make that NegationNode a child of another NegationNode, NOT a new NegationNode with the same child as the original NegationNode.
Public functions
getChild
fun getChild(): Node
Retrieve the child node of this Node.
This method will return the child node as a Node but could be of any type that implements Node. The caller should check what type the child node is and cast it to that type accordingly.
getChildren
fun getChildren(): (Mutable)List<Node!>
Retrieve the child node of this Node as a list containing the only child node.
This method will return the child node as a List of size one containing a Node but could be of any type that implements Node. The caller should check what type the child node is and cast it to that type accordingly.
setChild
fun setChild(child: Node): Unit
Set the child node that the NegationNode holds.
The node will be treated such that search will return everything not matching the term contained in the child.
| Parameters | |
|---|---|
child: Node |
The child node that |
toString
fun toString(): String
Get the string representation of NegationNode.
The string representation of NegationNode is "NOT" prepended to the string representation of the child Node.