apoc.search.nodeAllReduced

This procedure is not considered safe to run from multiple threads. It is therefore not supported by the parallel runtime. For more information, see the Cypher Manual → Parallel runtime.

Details

Syntax

apoc.search.nodeAllReduced(labelPropertyMap, operator, value) :: (id, labels, values)

Description

Returns a reduced representation of the NODE values found after a parallel search over multiple indexes. The reduced NODE values representation includes: node id, node labels, and the searched properties.

Input arguments

Name

Type

Description

labelPropertyMap

ANY

A map that pairs labels with lists of properties. This can also be represented as a JSON string.

operator

STRING

The search operator, can be one of: ["exact", "starts with", "ends with", "contains", "<", ">", "=", "<>", "⇐", ">=", "=~"].

value

ANY

The search value.

Return arguments

Name

Type

Description

id

INTEGER

The id of the found node.

labels

LIST<STRING>

The labels of the found node.

values

MAP

The matched values of the found node.

Example

Given this dataset:

CREATE (:Person {name: 'Alice Johnson', born: 1990})
CREATE (:Person {name: 'Bob Smith', born: 1985})
CREATE (:Movie {title: 'Alice in Wonderland', released: 2010, tagline: 'Follow Alice down the rabbit hole'})
CREATE (:Movie {title: 'The Matrix', released: 1999, tagline: 'Welcome to the Real World'})

The following query searches Person.name and Movie.title and Movie.tagline in parallel, returning one result per property match containing only the matched property value.

CALL
  apoc.search.nodeAllReduced(
    {Person: 'name', Movie: ['title', 'tagline']},
    'contains',
    'Alice'
  )
  YIELD labels, values
RETURN labels, values
Results
labels values

["Person"]

{name: "Alice Johnson"}

["Movie"]

{title: "Alice in Wonderland"}

["Movie"]

{tagline: "Follow Alice down the rabbit hole"}

The Movie node appears twice - once for each property that matched - and the values map shows only the property that caused that particular match. Use apoc.search.nodeReduced to merge these into a single row per node with all matched properties combined in values. The reduced result contains id (internal node id), labels, and values; yielding all three is useful when the full node object is not required.