How textScore field is calculated in mongodb full text search? [duplicate] How textScore field is calculated in mongodb full text search? [duplicate] mongodb mongodb

How textScore field is calculated in mongodb full text search? [duplicate]


  • Start with exp = 0;
  • Each time the term occurs:if exp = 0, set exp = 1, else set exp = 2 * exp;
  • Increment the frequency by 1/exp.

So, in fact, you are right that there is a sum of a geometric series here. If a term occurs k times, then the freq of the term (which is more like a score than a frequency, but it's called freq in the struct) will be1 + 1/2 + ... + (1/2)^(k - 1) = (1 - (1/2)^k)/(1 - 1/2) = 2 * (1 - 1/2^k)