0
votes

When I execute the below query in neo4j console, i get the correct result set. start n=node:search('username:*') return n.username;

I am using spring data neo4j in my java web app.

In the repository code, i defined query as:

@Query("START n=node:search({0}) RETURN n.name as name, n.username as username Parameter passed {0} = 'username:*'

There is no exception but the result set size is 0.

Can you please help me resolve the issue?

1
Not sure, but try to refere to your parameter with a String instead of an Integer (0), e.g. {luceneQuery}tstorms
Are you sure the data is indexed correctly? Index-name search index-key username ? Can you check that with a plain lucene lookup?Michael Hunger

1 Answers

1
votes

Unfortunately, the whole lucene query cannot be a parameter in Cypher, as far as I know. You'll need to resort to string concatenation/interpolation, probably. Similar to the issue I posted about relationship types as parameters: https://github.com/neo4j/neo4j/issues/340