keymaker
keymaker copied to clipboard
Can't use params in request using "WHERE IN {params}"
Here is an example of query
Keymaker.service.execute_cypher("START n=node:skillindex('*:*') MATCH (n)-[:belongsTo]->(x)<-[:belongsTo]-(y) , n-[:relatedTo*2..2]-y WHERE n.name IN [{names}] RETURN DISTINCT y limit 12", {names: skill_names})
I also tried {names: skill_names.map{|skill| "'#{skill}'"}.join(', ')}), IN [{names}] and just IN {names}
And this query runs fine on the neo4j console?
Yes, so I had to do something like this
Keymaker.service.execute_cypher("START n=node:skillindex('*:*') MATCH (n)-[:belongsTo]->(x)<-[:belongsTo]-(y) , n-[:relatedTo*2..2]-y WHERE n.name IN [#{skill_names}] RETURN DISTINCT y limit 12", {})