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

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.

Unit
setChild(child: Node)

Set the child node that the NegationNode holds.

Public constructors

NegationNode

Added in 1.1.0-alpha06
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

getChild

Added in 1.1.0-alpha06
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

setChild

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