Hi Michael , it works fine even increasing the limit my goal was to replicate the autocomplete feature from neo4j admin
thank you very much for your help best! Atte. Miguel Michelson Martinez www.vadb.org <http://vadb.org> On Mon, Jan 9, 2017 at 6:06 AM, 'Michael Hunger' via Neo4j < [email protected]> wrote: > Hey, what's your goal with this query? > > You can try this: > > MATCH p = (n:SomeLabel {db_id:1})-[r*2..3]-(a) > UNWIND nodes(p) as node > WITH COLLECT(distinct node) as nodes > UNWIND nodes as node > MATCH (node)-[r2]->(b) where b IN nodes > RETURN node as source , b as target, r2 as rel > LIMIT 170 > > alternatively you can try > > MATCH p = (n:SomeLabel {db_id:1})-[r*2..3]-(a) > UNWIND nodes(p) as node > WITH COLLECT(distinct node) as nodes > UNWIND nodes as a > UNWIND nodes as b > MATCH (a)-[r2]->(b) > RETURN a as source , b as target, r2 as rel > LIMIT 170 > > > On Mon, Jan 9, 2017 at 5:14 AM, Miguel Michelsongs < > [email protected]> wrote: > >> Hi all , >> >> I'm querying a graph trying to replicate the autocomplete feature from >> n4j admin, with the following cypher >> >> MATCH p = (n:SomeLabel}{db_id:1})-[r*2..3]-(a) >> UNWIND nodes(p) as allnodes >> WITH COLLECT(ID(allnodes)) AS ALLID >> MATCH (a)-[r2]-(b) where ID(a) IN ALLID AND ID(b) IN >> ALLID >> RETURN a as source , b as targets, r2 as rels >> LIMIT 170 >> >> if I increase the limit over 250 the query could take several minutes on >> my machine, is there a better approach doing only one query ? >> >> best >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Neo4j" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Neo4j" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/neo4j/kwDJQHBtKEQ/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
