Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
02-16-2021 11:50 AM
We have a node in the database that contains the text 'SSN". We can find that node easy enough.
Match (a) where a.text contains 'SSN' return a;
But now I need to trace its path from the node with SSN, all the way back to the root. (inode:0)
How do I combine a where contains in the qualifier for a.
Solved! Go to Solution.
02-17-2021 11:31 AM
correct. just add a 'set a.??????`
but why are you encoutering failures?
02-16-2021 11:55 AM
Match p=( (a)<-[*]-(n {inode:0}) ) where a.text contains 'SSN' return p
02-17-2021 11:21 AM
Surprisingly fast. Sorry it took me a bit to test. So if I want to update a property on a, can I just replace the return with a set ? Thanks again !
02-17-2021 11:31 AM
correct. just add a 'set a.??????`
but why are you encoutering failures?
02-17-2021 12:01 PM
Lol. Not your problem. We have been having rolling blackouts and -3F temperatures here. So it just took me longer than usual to set and test it. Solution was perfect.
02-18-2021 06:17 AM
Got a chance to test it and it does work perfectly. I do have a followup question.
p is a set of nodes. I want to set a flag on all of the p nodes that says they were part of the issue. So something along the lines of p.flag = true
How would I integrate that ? using just a or n gives me end points but nothing in between. Do I need to unwind p ?
02-17-2021 08:48 AM
For performance reasons, you may want to make SSN a separate property.
The condition where a.text contains 'SSN'
is expensive and may not scale well as your DB grows.
02-18-2021 06:57 AM
A more complete answer -
We are using this as a back stop. In most cases we do define the attributes separately, but the users always have one more thing that they want and if we add the search feature, it buys us time. These are run in batch, so if it takes 10-15 mins, thats annoying but not fatal. No human is waiting for it then.
We do worry about scaling so I appreciate the thought. Speed is always good.
Thanks
02-17-2021 11:13 AM
Clem - Can't be done that way for a variety of reasons and the DB is already over 3m nodes. It will probably top out at 30m. Thanks
02-18-2021 09:22 AM
I'm not sure what you mean.... If you have 3m nodes, then doing CONTAINS could be very expensive depending on how many of those you do...
One trick that could make things go faster, is use SSN as a Label instead of imbedded in a property string.
something like
CREATE(node:Person:SSN)
This would be especially good if very few nodes have SSN property, then finding them will be fast.
You can set (and remove) Labels easily.
02-18-2021 10:45 AM
Thanks. Appreciate the advice.
All the sessions of the conference are now available online