

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise
  1. I'm trying to understanding what kind of score does lucene performs during searching? I see Lucene TermVector contains bunch of statistics, when I search for a term, how the score is calculated in query time?

  2. Does TermVector and its statistics used during searching? if so how ?

share|improve this question

The Similarity class is responsible for scoring documents.

A Collector iterates over documents. It is used in conjunction with a Scorer to assign scores and to rank documents by those scores. A Scorer instance calculates scores under specific conditions. There are more than a dozen different kinds of scorers. For example, a TermScorer calculates the raw score as follows:


The weight value is derived from the query. If normalization is turned on at index time (so that scores between queries are more or less comparable), the normalization is applied after this. Normalization factors are pre-computed and cached.

share|improve this answer
Its obvious Similarity class is performing scoring, I'm looking for a specific detail, how does the scoring happens during search for ex: "cats dogs", what is the flow of scoring, how are the index information/stats are leveraged? – realnumber Jun 22 '11 at 16:56
The formulae used by Lucene are described on the Similary javadoc page in some detail, including how multi-term queries are handled. If you're interested in the implementation of all this machinery, take a look at Collector and Scorer classes. In general, it's a good idea to browse the Lucene code. – Gene Golovchinsky Jun 22 '11 at 18:37
i have already done part of that stuff going through lucene code and got confused, thanks for your answers anyways. i'm looking for some expert to help out to provide clear answer. – realnumber Jun 23 '11 at 5:42
I think the answers would be clearer if your question was more specific. – Gene Golovchinsky Jun 23 '11 at 16:46

Your Answer


