22 namespace Lucene.Net.Search
43 if (internalDiscountOverlaps)
44 numTerms = state.Length - state.NumOverlap;
46 numTerms = state.Length;
47 return (state.Boost * LengthNorm(field, numTerms));
51 public override float LengthNorm(System.String fieldName,
int numTerms)
53 return (
float) (1.0 / System.Math.Sqrt(numTerms));
57 public override float QueryNorm(
float sumOfSquaredWeights)
59 return (
float) (1.0 / System.Math.Sqrt(sumOfSquaredWeights));
63 public override float Tf(
float freq)
65 return (
float) System.Math.Sqrt(freq);
69 public override float SloppyFreq(
int distance)
71 return 1.0f / (distance + 1);
75 public override float Idf(
int docFreq,
int numDocs)
77 return (
float) (System.Math.Log(numDocs / (
double) (docFreq + 1)) + 1.0);
81 public override float Coord(
int overlap,
int maxOverlap)
83 return overlap / (float) maxOverlap;
89 protected internal bool internalDiscountOverlaps;
102 public virtual bool DiscountOverlaps
104 get {
return internalDiscountOverlaps; }
105 set { internalDiscountOverlaps = value; }