21 namespace Lucene.Net.Search
29 private int lastDoc = - 1;
32 : this(similarity, scorers.ToArray())
38 this.scorers = scorers;
39 coord = similarity.
Coord(scorers.Length, scorers.Length);
41 for (
int i = 0; i < scorers.Length; i++)
43 if (scorers[i].NextDoc() == NO_MORE_DOCS)
47 lastDoc = NO_MORE_DOCS;
57 System.Array.Sort(scorers, (a, b) => a.DocID() - b.DocID());
68 if (DoNext() == NO_MORE_DOCS)
71 lastDoc = NO_MORE_DOCS;
81 int end = scorers.Length - 1;
83 for (
int i = 0; i < max; i++)
86 int idx = end - i - 1;
87 scorers[i] = scorers[idx];
95 int doc = scorers[scorers.Length - 1].
DocID();
97 while ((firstScorer = scorers[first]).DocID() < doc)
100 first = first == scorers.Length - 1?0:first + 1;
105 public override int Advance(
int target)
107 if (lastDoc == NO_MORE_DOCS)
111 else if (scorers[(scorers.Length - 1)].DocID() < target)
113 scorers[(scorers.Length - 1)].Advance(target);
115 return lastDoc = DoNext();
118 public override int DocID()
123 public override int NextDoc()
125 if (lastDoc == NO_MORE_DOCS)
129 else if (lastDoc == - 1)
131 return lastDoc = scorers[scorers.Length - 1].DocID();
133 scorers[(scorers.Length - 1)].NextDoc();
134 return lastDoc = DoNext();
137 public override float Score()
140 for (
int i = 0; i < scorers.Length; i++)
142 sum += scorers[i].Score();