Lucene.Net.Search.FieldComparator.Copy C# (CSharp) Method

Copy() public abstract method

This method is called when a new hit is competitive. You should copy any state associated with this document that will be required for future comparisons, into the specified slot.
public abstract Copy ( int slot, int doc ) : void
slot int which slot to copy the hit to ///
doc int docID relative to current reader ///
return void
        public abstract void Copy(int slot, int doc);

Usage Example

Example #1
0
            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);
                    }
                }
            }