0

Using the latest Neo4jClient to access a Neo4j DB I can't successfully run the following Cypher query:

            var connections = _graphClient.Cypher
                                .StartWithNodeIndexLookup("n", "indexName", "'id:*'")
                                .Match("c=(n)-[:RELATIONSHIP_TYPE]-()")
                                .Return<MyRelationship>("c")
                                .Skip(5)
                                .Limit(10)
                                .Results;

This returns zero results. However it generates the following query:

START n=node:indexName('id:*') MATCH c=(n)-[:RELATIONSHIP_TYPE]-() RETURN c SKIP 5 LIMIT 10

When I run this directly through Neo4j's admin board I get the correct result set back.

What am I missing? Any help would be appreciated.

Piedone
  • 2,693
  • 2
  • 24
  • 43

1 Answers1

1

I think it's because of the single quotes you have in your index

var connections = _graphClient.Cypher
     .StartWithNodeIndexLookup("n", "indexName", "id:*") //<-- remove the single quotes
     .Match("c=(n)-[:RELATIONSHIP_TYPE]-()")
     .Return<MyRelationship>("c")
     .Skip(5)
     .Limit(10)
     .Results;

If you have this sort of problem again, the easiest thing to do is switch the StartWithNodeIndexLookup call with just Start and use a known node reference to check where the error could be occurring.

Charlotte Skardon
  • 6,220
  • 2
  • 31
  • 42
  • You nailed it, thank you! I wonder why it's a valid query through the web interface then? – Piedone Mar 11 '13 at 21:26
  • Actually the query is invalid without the apostrophes on the web admin. Seems interesting :-). – Piedone Mar 11 '13 at 21:37
  • Neo4jClient is adding the quotes for you, because they are mandatory, so you were sending ''id:*'' (notice the duplicated quotes) and then it was failing. http://hg.readify.net/neo4jclient/wiki/cypher has a section about how to debug queries. – Tatham Oddie Mar 26 '13 at 07:06