Re: [Neo4j] using SET only on the first X returned results

12 views
Skip to first unread message

Michael Hunger

unread,
Apr 28, 2013, 5:56:10 AM4/28/13
to ne...@googlegroups.com
Start n ....

With n
Limit 20
Set n.foo = 42

With is powerful, check it out in the manual http://docs.neo4j.org


Sent from mobile device

Am 28.04.2013 um 03:15 schrieb Cristian Malaia <cristia...@gmail.com>:

Hi Guys,

I have a question:

how can i use SET only for the first ...20 matches...?

like using set and limit?

thanks


--
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 neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Cristian Malaia

unread,
May 15, 2013, 5:12:25 AM5/15/13
to ne...@googlegroups.com
Thank you Michael,

Actually I did a little digging and I think I found a bug....

If the query is like that:
START 
me=node:objects('object_id:{userId}') 
MATCH 
me-[rel:ACTION_ADD_OBJECT]->myobjects
WITH 
        myobjects
MATCH 
myobjects<-[act:ACTION_LIKE]-user
SET
        act.viewed=1
WHERE
        act.viewed=0
RETURN
        myobjects,act,user
ORDER BY act.date DESC
SKIP 30
LIMIT 20

VERY IMPORTANT !

with the ORDER BY CLAUSE i get all ACT updated, and without ORDER BY I get only 20 which is correct
but not the right ones :)



Sorry for the delay...

Peter Neubauer

unread,
May 15, 2013, 9:48:01 AM5/15/13
to Neo4j User

Cristian,
Can you model an example of the bug in console.neo4j.org so we can recreate and then file a bug?

/peter

Sent from mobile device.

Cristian Malaia

unread,
May 15, 2013, 10:40:10 AM5/15/13
to ne...@googlegroups.com

Here are some tests:

Test 1: (order and limit)
http://console.neo4j.org/?id=1yt7mr

start n=node:node_auto_index(name='Neo') match n-[r:KNOWS*]-m set m.name='wrong' return n as Neo,r,m order by m.name desc limit 2

if you see all the nodes, disregarding the limit will be named "wrong"

Updated the graph - set 4 properties <- only two should be set

Test 2: (only limit without order)
http://console.neo4j.org/r/9gzwy0

start n=node:node_auto_index(name='Neo') match n-[r:KNOWS*]-m set m.name='wrong' return n as Neo,r,m limit 2

only two nodes, keeping track of the limit will be named "right"
Updated the graph - set 2 properties <- right

and the only difference between the queries is the order clause


I added to github too

Peter Neubauer

unread,
May 16, 2013, 9:29:12 PM5/16/13
to Neo4j User
thank you Cristian for the very thorough issue report, we will look at it ASAP!

/peter

Cheers,

/peter neubauer

G: neubauer.peter
S: peter.neubauer
P: +46 704 106975
L: http://www.linkedin.com/in/neubauer
T: @peterneubauer

The authoritative book on graph databases - http://graphdatabases.com
Neo4j questions? Please use SO - http://stackoverflow.com/search?q=neo4j

Cristian Malaia

unread,
May 17, 2013, 10:18:17 AM5/17/13
to ne...@googlegroups.com
so, this thread is closed. it was marked as BUG.
Reply all
Reply to author
Forward
0 new messages