-- Tatham Oddie Tiny keyboard = tiny message
Begin forwarded message: From: Tatham Oddie <tatham.od...@readify.onmicrosoft.com<mailto:tatham.od...@readify.onmicrosoft.com>> Date: 22 November 2011 14:43:00 AEDT To: "tat...@oddie.com.au<mailto:tat...@oddie.com.au>" <tat...@oddie.com.au<mailto:tat...@oddie.com.au>> Subject: FW: Lucene Custom Sort in Neo4j From: Tatham Oddie [mailto:tatham.od...@readify.onmicrosoft.com] Sent: Tuesday, 22 November 2011 2:42 PM To: Romiko Derbynew; user@lists.neo4j.org<mailto:user@lists.neo4j.org> Cc: mystory-develop...@barnardos.org.au<mailto:mystory-develop...@barnardos.org.au>; Tatham Oddie Subject: RE: Lucene Custom Sort in Neo4j http://docs.neo4j.org/chunked/snapshot/gremlin-plugin.html#rest-api-send-an-arbitrary-groovy-script---lucene-sorting Send something like this via /ext/GremlinPlugin/graphdb/execute_script: import org.neo4j.graphdb.index.* import org.neo4j.index.lucene.* import org.apache.lucene.search.* neo4j = g.getRawGraph() idxManager = neo4j.index() clientIndex = idxManager.forNodes('agency123-clients') query = new QueryContext( 'FamilyName:Smith' ).sort( new Sort(new SortField( 'GivenName',SortField.STRING, true ) ) ) results = clientIndex.query( query ) Pros: · It’ll work Cons: · You’d might as well stop calling it the “REST” API · It’s fragile to changes in either the “REST” API or the Java API – twice the chance of getting bitten · It requires us to string concatenate snippets of Java code together within our C# If you go down this route, please bury it very very deep in Neo4jClient and expose a nicer API signature on top. :) -- Tatham From: Romiko Derbynew [mailto:romiko.derby...@readify.onmicrosoft.com]<mailto:[mailto:romiko.derby...@readify.onmicrosoft.com]> Sent: Tuesday, 22 November 2011 2:36 PM To: user@lists.neo4j.org<mailto:user@lists.neo4j.org> Cc: mystory-develop...@barnardos.org.au<mailto:mystory-develop...@barnardos.org.au>; Tatham Oddie Subject: Lucene Custom Sort in Neo4j Hi Guys, What is the easiest way for me to build a custom full text sort for lucene in Neo4j, the thing is, we use the REST API to query the index, and I would like to apply a custom sort e.g. I want to change sorting to: Sort by Relevance (Booster) then by IndexKey1 then by indexKey2. Currently, we have the default sort via the query parser api, but it is not powerful enough(http://lucene.apache.org/java/3_1_0/queryparsersyntax.html). Any ideas, how we could do this, and still leverage the REST API for index queries? Cheers _______________________________________________ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user