This works: MATCH (m:Movie) WHERE m.tagline CONTAINS 'love' RETURN m.title
This does not work: MATCH (m:Movie) WHERE toLower(m.tagline) CONTAINS 'love' RETURN m.title
The error is "Expected a string value for 'toLower', but got: NO_VALUE..." Same error when I tried MATCH (m:Movie) WHERE toUpper(m.tagline) CONTAINS 'LOVE' RETURN m.title
What am I doing wrong?
If you have loaded Movie Graph using
:play movie graph and then ran Create statements then above query with tolower() and toUpper() should work.
I gave a try by myself and it is working fine.
However you can try below to see what exactly happening with m.tagline
MATCH (m:Movie) WHERE toLower(coalesce(toString(m.tagline), 'NO_VALUE')) CONTAINS 'love' RETURN m.title, m.tagline
Hmm... Yes, of course I loaded the Movie graph first. I've been moving forward in the tutorial since I posted and have had no problems with any of the other exercises I've done at this point (just finished the rest of 04.) Using toLower(coalesce(toString... works, but the original toLower(... still does not work.
What is the output of below
MATCH (m:Movie) WHERE toLower(coalesce(toString(m.tagline), 'NO_VALUE')) CONTAINS 'love' RETURN m, toLower(coalesce(toString(m.tagline), 'NO_VALUE'))
You are seeing the error with toLower() because one of the nodes does not have a tagline property. If all Movie nodes had a property, tagline, then you would. not see this error.
If this is the case, then why do some users (ie Vivek) say it works for them, but not for me? Given that we are all working with the same database, seems like there is another issue?
At some point in the course the student is instructed to add a tagline to this node. As long as all nodes have this property, then the statement will execute with no error.
I am ending this convo and starting a new thread. Long story short is we believe it is an underlying issue with Neo4j on a Mac.
Thank you for trying to help!
As a follow-up, this does seem to be a bug, but likely not OS specific.
More details here:
The error is unexpected, possibly a bug. I'll raise it internally for investigation.
Okay, here's what I found while tinkering:
This looks to be a bug when a function (such as toLower(), toUpper(), or toString(), and likely others) is part of a predicate that involves usage of some of our substring predicates: CONTAINS, STARTS WITH, and ENDS WITH, and when one of the values processed by the function is not present (effectively null).
A minimal reproduction without needing any data is: