Anormcypher 0.80, Scala 2.11.7
I'm attempting to exclude a list of items from a cypher result set by using 'AND NOT (value.title IN ['item1','item2']'.
The cypher query I'm running works in the neo4j console but does not exlcude item1 and item2 when I try to execute the same query using anormcypher. the query is as follows:
MATCH (c:Item)-[:INCLUDES_TERM]-(t:Term),(b:Box)-[:CONTAINS_TERM]-(t),
(b)-[r:IS_ABOUT_THING]-(thm:Thing)
where c.name = 'aName'
AND NOT (thm.title IN [('item1','item2')])
AND b.date >= 1443657600000 AND b.date <= 1443657700000
return DISTINCT(thm.title) as thing, count(b) as amount
order by amount desc LIMIT 50
In the neo4j console this cypher query will return a result with item1 and item2 filtered out.
If I run the query from scala using anormcypher, item1 and item2 will not be filtered out of the result. This is the code:
val exclusions:String = "'item1','item2'"
val name = "aName"
val startDate = "1443657600000"
val endDate = "1443657700000"
val cypherQuery = Cypher("""MATCH (c:Item)-[:INCLUDES_TERM]-(t:Term),(b:Box)-[:CONTAINS_TERM]-(t),
(b)-[r:IS_ABOUT_THING]-(thm:Thing)
where c.name = {item}
AND NOT (thm.title IN [{exclusions}])
AND b.date >= {startDate} AND b.date <= {endDate}
return DISTINCT(thm.title) as thing, count(b) as amount
order by amount desc LIMIT 50"""
).on("item" -> name, "startDate" -> startDate, "endDate" -> endDate, "exclusions" -> exclusions)
val resultList = cypherQuery.apply()
Why does this query work in the neo4j console but not work in scala using anormcypher?
The
exclusions
parameter should be an array of strings, not a single string that gets embedded in an array. Try this: