Alebon
Alebon

Reputation: 1187

Gremlin + Neo4j Lucene search

Does this gremlin script (executed via REST API of Neo4j) executes the sorting on the lucene index? Or are the nodes sorted in Neo4j?

g.idx('myIndex').get('name', 'aaa').sort{it.name}

Two additional questions: 1. How to set ordering? ASC/DESC 2. How to perform a fulltext search (LIKE). I already tried *, %, nothing worked

Upvotes: 2

Views: 577

Answers (2)

Dmitry Serebrennikov
Dmitry Serebrennikov

Reputation: 139

Besides doing what espeed suggested, which is using Gremlin's facilities to sort etc, you may also be interested in passing additional instructions down to Lucene itself. This can be done by prefixing the second argument into get with a magic string %query%. Like so:

... .get(null, "%query% _start_node_id_:15815486")

The key argument can be null if you don't need to use it.

Upvotes: 1

espeed
espeed

Reputation: 4824

sort is a Groovy method. To reverse the order, use reverse:

g.idx('myIndex').get('name', 'aaa').sort{it.name}.reverse()

See:

Upvotes: 1

Related Questions