Aerodynamika
Aerodynamika

Reputation: 8413

Several arguments apoc.index.relationships in Neo4J Cypher

I currently have a request:

 CALL apoc.index.relationships('TO','context:15229100-b20e-11e3-80d3-6150cb20a1b9') 
 YIELD rel, start, end

Does anybody know how I can search for several context values, for example, something like:

 CALL apoc.index.relationships('TO','context:15229100-b20e-11e3-80d3-6150cb20a1b9,context:a0328202-d98a-492e-92ae-1010cb829a8ee') 
 YIELD rel, start, end

Is it possible at all with apoc.index.relationships?

UPDATE

A possible way to do that would be to use UNION CALL so something like

 CALL apoc.index.relationships('TO','context:15229100-b20e-11e3-80d3-6150cb20a1b9') 
 YIELD rel, start, end
 UNION CALL apoc.index.relationships('TO','context:15229100-b20e-11e3-80d3-6150cb20a1b9,context:a0328202-d98a-492e-92ae-1010cb829a8ee') 
 YIELD rel, start, end

Which produces good results. But I'm wondering if there's a more elegant way to do this that would also make the request shorter?

Thanks!

Upvotes: 0

Views: 26

Answers (1)

Michael Hunger
Michael Hunger

Reputation: 41706

You can use lucene syntax:

context:15229100-b20e-11e3-80d3-6150cb20a1b9 OR context:15229100-b20e-11e3-80d3-6150cb20a1b9

or even with an array:

context:(15229100-b20e-11e3-80d3-6150cb20a1b9 15229100-b20e-11e3-80d3-6150cb20a1b9)

https://lucene.apache.org/core/2_9_4/queryparsersyntax.html

Upvotes: 1

Related Questions