I'm trying to pass in multiple words for a search algorithm to Neo4j's @Query annotation in Spring Boot. Here is what I'm trying:
@Query("WITH [{search}] AS sarray "
+ "MATCH (a:Node) "
+ "WHERE ALL(s IN sarray WHERE a.name=~('(?i).*'+s+'.*') " // <- This is known good regex
//The rest of the query which is known good
This query works perfectly in the Neo4j web interface like this:
WITH ["some","search","terms"] AS sarray
What I've tried:
- Passing in a single string with commas between the multiple words
- Passing into the {search} variable an ArrayList
- Passing into the {search} variable an array
- Removing the brackets in annotation
- Probable other things that didn't work either
The error that I get back says "Invalid Regex: Illegal repetition near index 5 (?i).{search}.^"
This regex does work before changing the query to include the multiple words.