apoc.search.nodeReducedProcedure
|
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. |
Syntax |
|
||
Description |
Returns a reduced representation of the distinct |
||
Input arguments |
Name |
Type |
Description |
|
|
A map that pairs labels with lists of properties. This can also be represented as a JSON string. |
|
|
|
The search operator, can be one of: ["exact", "starts with", "ends with", "contains", "<", ">", "=", "<>", "⇐", ">=", "=~"]. |
|
|
|
The search value. |
|
Return arguments |
Name |
Type |
Description |
|
|
The id of the found node. |
|
|
|
The labels of the found node. |
|
|
|
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.nameandMovie.titleandMovie.taglinein parallel, returning one result per distinct node with all matched property values merged
CALL
apoc.search.nodeReduced(
{Person: 'name', Movie: ['title', 'tagline']},
'contains',
'Alice'
)
YIELD labels, values
RETURN labels, values
| labels | values |
|---|---|
["Person"] |
{name: "Alice Johnson"} |
["Movie"] |
{title: "Alice in Wonderland", tagline: "Follow Alice down the rabbit hole"} |
The Movie node matched on both title and tagline, but apoc.search.nodeReduced deduplicates by node identity and merges the matched properties into a single values map.
Compare with apoc.search.nodeAllReduced, which returns a separate row for each property match and does not merge.