Use BM25 score from Elasticsearch to order the results.
Hello Dear Janusgraph Community !
Hope every one does great these days.
I couldn't find an answer online, so trying my luck here.
Perhaps, you can help me understand how can I get Gremlin results sorted according to BM 25 search score provided by Elasticsearch.
So, I want to use mixed index with multiple vertex properties indexed as TEXT in ES and get the results based on full-text search with different boost weights.
For example, having mixed index include:
Property "Name" with boost of 0.5.
Property "Topic" with boost of 0.4.
Property "Desc" with boost of 0.1.
I would expect the results to be sorted with the relevance score as I execute my query
I could achieve the desired with 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 ecosystem.
If it is not currently implemented, perhaps there is a way to customize the query and inject my own sorting and ordering mechanism using some smart steps like withSideEffect() or any other black-magic-trickery, if that Is that even possible ?
Thank you in advance for any help,
Michael
2 Replies
I think you would have to modify JanusGraph source code to support this
Oh, that makes me think my approach might be wrong. I mean, there must be a good reason why Janusgraph developers chose not to include score into gremlin's ordering, but provide access to the internal indexQuery() method. I don't belive they have just overlooked it.
That is what I would pretty much wanted to hear from the developers. That direct indexQuery() method together with getScore() were exposed exactly for any third party to implement any ordering according to business logic in their application.
But then it doesn't make sense for gremlin server when working from remote, cause only embedded Janus have graph variable that can do direct index queries.
So, I am confused here 🙄