public override void Collect(int doc)
{
++totalHits;
if (queueFull)
{
if ((reverseMul * comparator.CompareBottom(doc)) <= 0)
{
// since docs are visited in doc Id order, if compare is 0, it means
// this document is largest than anything else in the queue, and
// therefore not competitive.
return;
}
// This hit is competitive - replace bottom element in queue & adjustTop
comparator.Copy(bottom.slot, doc);
UpdateBottom(doc);
comparator.SetBottom(bottom.slot);
}
else
{
// Startup transient: queue hasn't gathered numHits yet
int slot = totalHits - 1;
// Copy hit into queue
comparator.Copy(slot, doc);
Add(slot, doc, System.Single.NaN);
if (queueFull)
{
comparator.SetBottom(bottom.slot);
}
}
}