How to get relevance score each item in the returned result?
List hits = searchSession.search( Book.class )
.where( f → f.match().field( “title” )
.matching( “robot dawn” ) )
.sort( f → f.score() )
.fetchHits( 20 );
How to get relevance score each item in the returned result?
List hits = searchSession.search( Book.class )
.where( f → f.match().field( “title” )
.matching( “robot dawn” ) )
.sort( f → f.score() )
.fetchHits( 20 );
It’s in the documentation: score
projection.
And if you want the entity and the score, use both the score
projection and the entity
projection, and combine them with a composite
projection.
Thanks used projection and it is working fine