losty
losty

Reputation: 147

Neo4j Spring Data GraphRepository param list

I'm trying to do a Cypher IN query, using neo4j, spring data graph repository

public interface StuffRepository extends GraphRepository {

Vote findByUniqueKey(String uniqueKey);

@Query(value = "MATCH (Stuff)" +
        "USING INDEX n:Vote(uniqueKey)" +
        "WHERE n.uniqueKey IN {keys}" +
        "RETURN n")
List<Stuff> findAllWithKeys(@Param("keys") List<String> keys);

}

from the logs i can see that the generated query looks like:

MATCH (n:Stuff) USING INDEX n:Stuff(uniqueKey) WHERE n.uniqueKey IN {keys} RETURN n

params {keys=['key1', 'key2']}

(thats how it logs anyway - I know the params are not passed like that in the cypher)

if I copy the query from the logs and run it without using the params:

MATCH (n:Stuff) USING INDEX n:Stuff(uniqueKey) WHERE n.uniqueKey IN ['key1', 'key2'] RETURN n

It works, and returns me my 2 'Stuff', but from my repository query I am getting back zero results.

Any ideas why params is not working as I'd expect for Cypher?

Upvotes: 0

Views: 622

Answers (1)

Michael Hunger
Michael Hunger

Reputation: 41676

Can you try a string[] instead, might be a bug in parameter conversion. If so please raise a jira issue.

Upvotes: 1

Related Questions