lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Elschot <>
Subject Re: Scoring a single document from a corpus based on a given query
Date Wed, 10 Oct 2007 17:47:59 GMT
On Wednesday 10 October 2007 18:44, lucene_user wrote:
> I would like to score a single document from a corpus based on a given
> query. The formula score(q,d) is basically what I am looking for.
> Pseudo Code of Something Close to what I am looking for:
> indexReader.score(query, documentId);
> The formula score(q,d) is used throughout the documentation to describe
> similarity but there does not seem to be a corresponding java method.
> I could work around the issue by applying a search filter to only consider
> the particular document I am looking for.  I was hoping for a cleaner
> approach.

You can try this:

Explanation e = indexSearcher.explain(query, documentId);

and get the score value from the explanation.

Have a look at the code of any Scorer.explain() method on
how to get the score value only. There really is no need to filter
in this case.

Paul Elschot

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message