keymaker icon indicating copy to clipboard operation
keymaker copied to clipboard

Can't use params in request using "WHERE IN {params}"

Open linko opened this issue 11 years ago • 2 comments

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}

linko avatar May 27 '13 10:05 linko

And this query runs fine on the neo4j console?

therubymug avatar Jun 05 '13 05:06 therubymug

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", {})

linko avatar Jun 05 '13 11:06 linko