Ability to project Lucene meta information (Score, Boost, Document, Id, This) (John Griffin)

Description

I need the score of a hit. The only time when this information is available seems to be in FullTextQueryImpl.java in line 219:

for ( int index = first; index <= max; index++ ) {
Document document = hits.doc( index );
infos.add( extractor.extract( document ) );
}

Not sure what the API would look like and what other information from each Hit object would be considered metadata, except the score and maybe boost. Maybe this can be covered with magic projection properties, something like:

org.hibernate.search.FullTextQuery query = s.createFullTextQuery( luceneQuery, Book.class );
query.setIndexProjection( "hsearchScore", "this" );
List results = query.list();
Object[] firstResult = (Object[]) results.get(0);
Double score = firstResult[0];
Book book = firstResult[1];

Environment

None

Status

Assignee

John Griffin

Reporter

Christian Bauer

Labels

None

Suitable for new contributors

None

Pull Request

None

Feedback Requested

None

Components

Fix versions

Affects versions

Priority

Critical
Configure