I can't say why the first query isn't working, I can't test it right now as my version of Neo4j isn't letting me use parameters in my MATCH
clause. However - I do get my version (below) responding fine. In terms of timing out, the [*..150]
is quite a large potential traversal.
could you try running:
var pathsQuery =
Client.Cypher
.Match("p = shortestPath((ab:Point)-[*..150]-(cd:Point))")
.Where((PointEntity ab) => ab.Latitude == 24.96325)
.AndWhere((PointEntity ab) => ab.Longitude == 67.11343)
.AndWhere((PointEntity cd) => cd.Latitude == 24.95873)
.AndWhere((PointEntity cd) => cd.Longitude == 67.10335)
.Return(p => new PathsResult<PointEntity>
{
Nodes = Return.As<IEnumerable<Node<PointEntity>>>("nodes(p)"),
Relationships = Return.As<IEnumerable<RelationshipInstance<object>>>("rels(p)")
});
var res = pathsQuery.Results;
Where PathsResult
is defined as:
public class PathsResult<TNode>
{
public IEnumerable<Node<TNode>> Nodes { get; set; }
public IEnumerable<RelationshipInstance<object>> Relationships { get; set; }
}
The benefit here is that the WHERE
clauses are paramaterized.