Hello, I have a simple cypher query with a WHERE clause and not other logic that looks something like:
WHERE node.propValue = 'string value with spaces'
Replacing the "=" with CONTAINS, STARTS WITH, ENDS WITH, and TRIM() returns the expected results without changing the value right of the equals sign.
To troubleshoot, I have checked that the type of the property value I am expecting is STRING. I have used the SIZE() function to check for leading or trailing characters.
When I return the value, there is no difference between the output and what I have in the where clause when I used the "=". I even exported the result produced when using the CONTAINS to CSV, opened in Notepad++ to ensure no special characters, etc. , re-pasted the value in the query and re-ran with the "=" but nothing returned. Really confused by this.
me too. So, you get a result returned with all three: 'contains', 'starts with', and 'ends with'? The only way that is possible is if the string is equal to the literal value or the string is a concatenation of the literal value, any literal string, and the literal value. That of course, is not the case for you, so the string should be equal to the literal value.
Try the following to see what each character is:
match(node) WHERE node.propValue CONTAINS 'string value with spaces' with node.propValue as x with x, size(x) as size with x, range(0,size-1) as indexes unwind indexes as index return substring(x, index, 1) as character
You are correct; I get the expected results when using 'contains', 'starts with', and 'ends with' but also when using toString and trim functions on node.propValue
After running the above in my environment I get the expected results of:
That seems to check out. Thank you for all your help with this.
No idea what happened to those other posts. Hopefully a moderator can get them back because they were useful for context.
Correct. Every character, including spaces, from the literal string were returned and nothing more. Not sure if you saw, but using toString(node.propValue) also returns expected results.
I dont see any posts missing from the thread here. The last I can see is the link below.