I have an issue on my cypher query. In my database for example, I want to select similar people to a person according to his last name, first name and year of birth. If I don't find any one with the exact matching, I will then do a query to find people with same last name and year of birth. Lastly, if I don't find any match for my second query, I will do a third match to find if there are any people how have the same year of birth as the person's. How do I combine this three query into one. I think for a large database, this type of query is very expansive, so I need some way to optimize this logic.
You can try Union all to have on query