Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Limit the results of a union cypher query

Tags:

neo4j

cypher

Let's say we have the example query from the documentation:

MATCH (n:Actor)
RETURN n.name AS name
UNION
MATCH (n:Movie)
RETURN n.title AS name

I know that if I do that:

MATCH (n:Actor)
RETURN n.name AS name
LIMIT 5
UNION
MATCH (n:Movie)
RETURN n.title AS name
LIMIT 5

I can reduce the returned results of each sub query to 5.How can I LIMIT the total results of the union query?

like image 976
salvador Avatar asked Nov 27 '25 06:11

salvador


1 Answers

This is not yet possible, but there is already an open neo4j issue that requests the ability to do post-UNION processing, which includes what you are asking about. You can add a comment to that neo4j issue if you support having it resolved.

like image 188
cybersam Avatar answered Nov 29 '25 23:11

cybersam