Use in neo4j clauses WHERE conditioning if value exists

Asked

Viewed 23 times

0

Good afternoon, you guys!

I’m having a little doubt and I haven’t found an elegant answer in the documentation of neo4j.

I am mounting an endpoint with multiple combination parameters for search, so it is possible that some of the parameters either come empty or null. In this way, I would like to apply the WHERE clauses only when there is value in the parameter.

If anyone can give an orientation of how to do.

PS: I saw in the Expressions documentation the "CASE", however I do not know if it is feasible to put inside the WHERE several concatenated CASES.

Thank you!! ;)

  • And what programming language are you using to mount the query itself? I don’t know neo4j, but in SQL, I usually solve this in the query assembly, building the string that represents it. Regardless, do not want to add to the question an example of the query, and maybe some of the code around which you already have there?

  • I am using the following query: MATCH (n:Place) WHERE ( n. country = '' XOR n. state = '' XOR n. city = '' XOR n. latitude = 34.2651 XOR n. longitude = -77.867 XOR n. name =~ '..' XOR n. businessActivity =~ '' XOR n. businessSubActivity =~ ' ) RETURN n SKIP 0 LIMIT 20

  • I am using Cypher.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.