apoc.search.multiSearchReduced

Procedure APOC Core

Do a parallel search over multiple indexes returning a reduced representation of the nodes found: node id, labels and the searched properties. apoc.search.multiSearchReduced( map of label and properties which will be searched upon, operator: EXACT | CONTAINS | STARTS WITH | ENDS WITH, searchValue ). Multiple search results for the same node are merged into one record.

Signature

apoc.search.multiSearchReduced(LabelPropertyMap :: ANY?, operator :: STRING?, value :: STRING?) :: (id :: INTEGER?, labels :: LIST? OF STRING?, values :: MAP?)

Input parameters

Name Type Default

LabelPropertyMap

ANY?

null

operator

STRING?

null

value

STRING?

null

Output parameters

Name Type

id

INTEGER?

labels

LIST? OF STRING?

values

MAP?

Usage Examples

The examples in this section are based on the following sample graph:

MERGE (shambar:Recipe {name: "Shambar"})
MERGE (cornedBeefPie:Recipe {name: "Corned beef pie"})

MERGE (beef:Ingredient {name: "beef"})
MERGE (pork:Ingredient {name: "pork"})
MERGE (chickpea:Ingredient {name: "chickpea"})
MERGE (potatoes:Ingredient {name: "potatoes"})

MERGE (shambar)-[:CONTAINS_INGREDIENT]->(beef)
MERGE (shambar)-[:CONTAINS_INGREDIENT]->(pork)
MERGE (shambar)-[:CONTAINS_INGREDIENT]->(chickpea)

MERGE (cornedBeefPie)-[:CONTAINS_INGREDIENT]->(beef)
MERGE (cornedBeefPie)-[:CONTAINS_INGREDIENT]->(potatoes);
CALL apoc.search.multiSearchReduced(
  {Recipe: "name", Ingredient: "name"},
  "CONTAINS",
  "beef"
);
Table 1. Results
id labels values

1

["Recipe"]

{name: "Corned beef pie"}

2

["Ingredient"]

{name: "beef"}