Incorrect sort order with Neo4jClient Cypher query -
i have following neo4jclient code
var queryitem = _graphclient .cypher .start(new { n = node.byindexlookup("myindex", "name", sku), }) .match("p = n-[r:relationship]->ci") .with("ci , r") .return((ci, r) => new { n = ci.node<item>(), r = r.as<relationshipinstance<payload>>() }) .limit(5) .results .orderbydescending(u => u.r.data.frequency);
the query executing fine results not sorted correctly (i.e. in descending order). here payload class well.
please let me know if see wrong code. tia.
you're doing sorting after .results
call. means you're doing in .net, not on neo4j. neo4j returning 5 results, because cypher query doesn't contain sort instruction.
change last 3 lines to:
.orderbydescending("r.frequency") .limit(5) .results;
as general debugging tip, neo4jclient 2 things:
- it helps construct cypher queries using fluent interface.
- it executes these queries you. dumb process: send text neo4j, , gives objects back.
the execution working, need work out why queries different.
- read doco @ http://hg.readify.net/neo4jclient/wiki/cypher (we write reason)
- read "debugging" section on page tells how query text
- compare query text expected run
- resolve difference (or report issue @ http://hg.readify.net/neo4jclient/issues/new if it's library bug)
Comments
Post a Comment