|limit results passed to WITH||Yaron Naveh||9/29/12 5:39 PM|
Take a look at this query:
MATCH (n)-[:depends_on]->(x), (n)-[:depends_on]->(y)
WITH x as x, y as y
MATCH z = x-[depends_on*1..1]->y
(in simple words: the first part gathers all nodes that depend_on node #1, and the second part returns all links between all nodes from before to themselves)
The first part before the WITH returns a huge amount of results, and now all of them are being matched at z. I would like to have something like this:
WITH x as x, y as y LIMIT 100
such that only first 100 results are passed along to the heavy processing. Is it possible?
Currently my query is stack due to this.
|Re: [Neo4j] limit results passed to WITH||Peter Neubauer||9/30/12 1:33 AM|
this is a request that has been coming up frequently. Could you please
open a feature request issue on this? For the time being, the Java API
(especially the traverals, see
can do this, since you can specify your own Expanders and Evaluators.
Is that an option?
P: +46 704 106975
Wanna learn something new? Come to http://graphconnect.com
|Re: [Neo4j] limit results passed to WITH||Yaron Naveh||9/30/12 5:41 AM|
I'm using cypher over http via the node.js driver, so this is not an option for me.
I'm on Twitter (@YaronNaveh)
|Re: [Neo4j] limit results passed to WITH||Yaron Naveh||9/30/12 6:09 AM|
Maybe I can statistically reduce the results?
WITH x as x...
Is there a modulo operation or something similar? Otherwise I can assign a value 1..4 by myself to nodes though it is much less flexible.
|Re: [Neo4j] limit results passed to WITH||Michael Hunger||9/30/12 8:03 AM|
There is a modulo operation, with % as you said.
And you can perhaps use collect and then "filter" on those.