AnonyMouse
AnonyMouse

Reputation: 442

Why is Solr not ranking by the largest similarity factor?

I've created a custom similarity class, and I want Solr to rank by coord(). In my results, the document with this debug query result

 0.0 = (MATCH) weight(text:现在 in 0) [MyNewSimilarityClass], result of:
      0.0 = score(doc=0,freq=1.0 = termFreq=1.0
         ), product of:
        0.0 = queryWeight, product of:
          0.0 = idf(docFreq=103081, maxDocs=4060152)
          0.0 = queryNorm
        0.0 = fieldWeight in 0, product of:
          0.0 = tf(freq=1.0), with freq of:
            1.0 = termFreq=1.0
          0.0 = idf(docFreq=103081, maxDocs=4060152)
          1.0 = fieldNorm(doc=0)
  1.43425728E8 = coord(2/167)

ranked higher than the document with this debug query result

 0.0 = (MATCH) weight(text:中国 in 5) [MyNewSimilarityClass], result of:
      0.0 = score(doc=5,freq=1.0 = termFreq=1.0),
        product of:
        0.0 = queryWeight, product of:
          0.0 = idf(docFreq=39366, maxDocs=4060152)
          0.0 = queryNorm
        0.0 = fieldWeight in 5, product of:
          0.0 = tf(freq=1.0), with freq of:
            1.0 = termFreq=1.0
          0.0 = idf(docFreq=39366, maxDocs=4060152)
          1.0 = fieldNorm(doc=5)
  8.9641069E8 = coord(5/167)

Both are equal aside from the coord() factor, why is it not putting the higher resulting coord() factor first in the ranking?

Upvotes: 0

Views: 214

Answers (1)

MatsLindh
MatsLindh

Reputation: 52792

Since your other scoring factors are zero, the total score for both documents are zero / 0 (which is the value shown first). The scoring is (mainly) a product of each term (and not additive).

See Lucene's Practical and Conceptual Scoring Formula.

Upvotes: 2

Related Questions