Nik Kovac
Nik Kovac

Reputation: 195

fetching score per term in a specific field

I'm currently using the snapshot version on lucene 4.0 (because of bm25), I was wondering on a possibility of getting the score for a given term. For e.g., on the index I store two fields per document, namely the content of a document in contents field and authors in authors field. Now, when I retrieve the documents, I fetch authors as well, but when I fetch authors, I would live to get the scores per each author (collection wide score), so that I can have a sort of ranking of authors.

I.e., is it possible that after fetching authors, to query lucene for each author and this way to find its respective score (I'm relying on the BM25 scoring model)? Is yes, is this the best way to do so?

thanks a lot

Upvotes: 0

Views: 366

Answers (1)

Robert Muir
Robert Muir

Reputation: 3195

Use explain() if you are just debugging.

Otherwise, if you really need 'sub-scores' or 'scores for only a portion of the query', simply run that part of the query by itself, or if thats not fast enough, walk the Scorer hierarchy using Scorer.getChildren() in your Collector, saving references to the subscorers you care about.

Then in your collectors collect() you could capture those subscores too.

Upvotes: 1

Related Questions