Yep probably
Sent from mobile device
Am 01.08.2014 um 14:51 schrieb Michael Azerhad :
> I had to add the keyword DISTINCT in my return clause like this:
> ...
> UNWIND cars as extractedCars
> RETURN DISTINCT(extractedCars)
>
> It took now about 150ms that is pretty fast.
> Is DISTINCT the be
I had to add the keyword DISTINCT in my return clause like this:
...
UNWIND cars as extractedCars
RETURN DISTINCT(extractedCars)
It took now about 150ms that is pretty fast.
Is DISTINCT the best strategy in this case to avoid duplicates?
Michael
On Friday, August 1, 2014 2:26:19 PM UTC+2, Mi
I guess I found the reason of the slowness:
If Person A is friend with B, and B is friend with C and C is friend with A
(cyclic), then the query returns duplicated cars.
I end up with 180 cars instead of 51 ..
--
You received this message because you are subscribed to the Google Groups
"Neo4
I tried one of the query you suggested:
MATCH (loggedUser:Person{id: 123})-[:KNOWS]-(p1:Person)
OPTIONAL MATCH (p1)-[:SELLS]->(c1:Car)
WITH p1, collect(c1)[0..{limit}] as cars
OPTIONAL MATCH (p1)-[:KNOWS]-(p2:Person)
OPTIONAL MATCH (p2)-[:SELLS]->(c2:Car:Degree2)
WITH p2, case when length(cars) <
wow! I wasn't aware of 'unwind' keyword, perfect ! And backported to 2.0.4
:)
Thanks a lot Michael, really appreciate :)
Michael
Le 1 août 2014 à 10:56, Michael Hunger a
écrit :
You can sort on the client or use this at the end:
unwind cars as car
return car
order by car.name asc
Michael
On
You can sort on the client or use this at the end:
unwind cars as car
return car
order by car.name asc
Michael
On Fri, Aug 1, 2014 at 9:41 AM, Michael Azerhad
wrote:
> Hello Michael,
>
> Thanks for this really great detailed answer ! Like it :)
>
> However I have a question :
>
> I do really
Hello Michael,
Thanks for this really great detailed answer ! Like it :)
However I have a question :
I do really prefer the last way (at the very bottom) using cypher and
expressions to lazily limit results.
I wonder whether it's also possible to order by car's name (not only
limiting) the whole
Not sure if I'd use cypher for those data volumes.
I think in this case some imperative code filling a set of cars might be
more sensible (i.e. a server extension)
And using a label for the Car-Degree. (Alternatively you could also use a
SELL1, SELL2 rel-type for the degrees, and then check if it
Fix of my query above, I missed to specify the logged user node:
MATCH (d:Degree {id: 1})<-[:TARGET_TO]-(c:Car)<-[:SELLS]-(p:Person)-[KNOWS
]-(loggedUser:Person{id: 123})
RETURN c
UNION
MATCH (d:Degree {id: 2})<-[:TARGET_TO]-(c:Car)<-[:SELLS]-(p:Person)-[KNOWS
*..2]-(loggedUser:Person{id: 123})
R