Lucene neo4j sort with boolean fields
- by Daniele
I have indexed some documents (nodes of neo4j) with a boolean property which not always is present.
Eg.
Node1
label : "label A"
Node2:
label : "label A" (note, same label of node1)
special : true
The goal is to get Node2 higher than node 1 for query "label A".
Here the code:
Index<Node> fulltextLucene = graphDb.index().forNodes( "my-index" );
Sort sort = new Sort(new SortField[] {SortField.FIELD_SCORE,
new SortField("special", SortField.????, true) });
IndexHits<Node> results = fulltextLucene.query( "label", new QueryContext( "label A").sort(sort));
How can I accomplish that?
Thanks