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 NegationNode that takes in a child node of any Node type.

Public functions

Boolean
equals(o: Any!)
Node

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
Unit
setChild(child: Node)

Set the child node that the NegationNode holds.

String

Get the string representation of NegationNode.

Public constructors

NegationNode

Added in 1.1.0-alpha07
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.

Parameters
childNode: Node

The Node representing some query to be logically negated.

Public functions

equals

fun equals(o: Any!): Boolean

getChild

Added in 1.1.0-alpha07
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.

Returns
Node

The child Node representing a query that is being logically negated that could be cast to a type that implements Node

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.

Returns
(Mutable)List<Node!>

A list of size one containing a child Node representing a query that is being logically negated that could be cast to a type that implements Node

hashCode

fun hashCode(): Int

setChild

Added in 1.1.0-alpha07
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 NegationNode will hold.

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.