I just recently I came across an issue where I haven’t found a solution how to handle the error.
The actual use case/node schema is more complicated, but to make it simple let’s say I have a bunch of nodes
:Document with a property
title of course is always a string and searching for all nodes having
'foo' in the title I’d query with
MATCH (d:Document) WHERE d.title CONTAINS 'foo' RETURN d. Everything fine so far.
Now if for any reason a new node gets inserted with
title being an object/map or array/list the whole query fails. It’s not just skipping this node and returns the rest as before but just no result with the error “Query failed: ‘contains’ argument at position 1 must be either ‘null’ or ‘string’.”.
Is it possible to somehow handle that? Like in skipping the node that has a wrong type on the property or add something to the WHERE to skip that node explicitly? I couldn’t find any function to do something like
type(title) = 'string'. That also means I’m having a hard time finding the nodes that are causing issues, because I can’t match them with a query to quickly fix them.