22 namespace Lucene.Net.Search
29 private static readonly
float[] SIM_NORM_DECODER;
34 private float weightValue;
35 private int doc = - 1;
37 private int[] docs =
new int[32];
38 private int[] freqs =
new int[32];
40 private int pointerMax;
42 private const int SCORE_CACHE_SIZE = 32;
43 private float[] scoreCache =
new float[SCORE_CACHE_SIZE];
62 this.weightValue = weight.
Value;
64 for (
int i = 0; i < SCORE_CACHE_SIZE; i++)
70 Score(c, System.Int32.MaxValue, NextDoc());
74 public override bool Score(
Collector c,
int end,
int firstDocID)
82 if (++pointer >= pointerMax)
84 pointerMax = termDocs.Read(docs, freqs);
92 doc = System.Int32.MaxValue;
101 public override int DocID()
113 public override int NextDoc()
116 if (pointer >= pointerMax)
118 pointerMax = termDocs.Read(docs, freqs);
126 return doc = NO_MORE_DOCS;
133 public override float Score()
135 System.Diagnostics.Debug.Assert(doc != - 1);
136 int f = freqs[pointer];
137 float raw = f < SCORE_CACHE_SIZE?scoreCache[f]:
Similarity.
Tf(f) * weightValue;
139 return norms == null?raw:raw * SIM_NORM_DECODER[norms[doc] & 0xFF];
151 public override int Advance(
int target)
154 for (pointer++; pointer < pointerMax; pointer++)
156 if (docs[pointer] >= target)
158 return doc = docs[pointer];
163 bool result = termDocs.SkipTo(target);
168 docs[pointer] = doc = termDocs.Doc;
169 freqs[pointer] = termDocs.Freq;
179 public override System.String ToString()
181 return "scorer(" + weight +
")";