-
How can I get Gremlin search results sorted according to Okapi BM25 relevance score provided by Elasticsearch? I want to use mixed index with number of vertex properties indexed as TEXT in ES and get the results based on full-text search with different boost weights. For example, having my mixed index include:
I would expect the results to be sorted with the relevance score in mind as I execute my query, or get the score together with gremlin response to sort it later in the application.
I could achieve the desired results by querying index directly with indexQuery() method, getting the correct relevance score with getScore(), but I would very much like to have it working within gremlin. If it is not currently implemented, perhaps there is a way to customize the query and inject my own sorting/ordering mechanism using some smart mechanics like TraversalStrategy. Is that even possible? Link to StackOverflow |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
That's a good feature request and shouldn't be hard to implement if we agree on the interface itself. Potentially, we could introduce some internal parameters that can be used in Gremlin queries.
In this case we would probably need an optimization strategy that checks validity of such parameters usage (if the previous steps are merged into the mixed index or not) and adds metadata information to indexes usage. In all other cases we should probably raise the exception as the query becomes invalid otherwise. However, I don't have a strong opinion here and am open to any other solutions if someone wants to contribute it somehow else. As for returning When you query As such, to return Perhaps TinkerPop community can add some input on this (i.e. semantically correct way of returning arbitrary data that's not part of the Element definition). |
Beta Was this translation helpful? Give feedback.
That's a good feature request and shouldn't be hard to implement if we agree on the interface itself.
Potentially, we could introduce some internal parameters that can be used in Gremlin queries.
For example:
In this case we would probably need an optimization strategy that checks validity of such parameters usage (if the previous steps are merged into the mixed index or not) and adds metadata information to indexes usage. In all other cases we should probably raise the exception as the query becomes inva…