Lucene.Net.Search.Collector.Collect C# (CSharp) Method

Collect() public abstract method

Called once for every document matching a query, with the unbased document number.

Note: This is called in an inner search loop. For good search performance, implementations of this method should not call Searcher.Doc(int) or Lucene.Net.Index.IndexReader.Document(int) on every hit. Doing so can slow searches by an order of magnitude or more.

public abstract Collect ( int doc ) : void
doc int
return void
		public abstract void  Collect(int doc);
		

Usage Example

		// firstDocID is ignored since nextDoc() sets 'doc'
		public /*protected internal*/ override bool Score(Collector c, int end, int firstDocID)
		{
			c.SetScorer(this);
			while (doc < end)
			{
				// for docs in window
				c.Collect(doc); // collect score
				
				if (++pointer >= pointerMax)
				{
					pointerMax = termDocs.Read(docs, freqs); // refill buffers
					if (pointerMax != 0)
					{
						pointer = 0;
					}
					else
					{
						termDocs.Close(); // close stream
						doc = System.Int32.MaxValue; // set to sentinel value
						return false;
					}
				}
				doc = docs[pointer];
			}
			return true;
		}
All Usage Examples Of Lucene.Net.Search.Collector::Collect