Implements search over a single IndexReader.
///
/// Applications usually need only call the inherited {@link #Search(Query)}
/// or {@link #Search(Query,Filter)} methods. For performance reasons it is
/// recommended to open only one IndexSearcher and use it for all of your searches.
///
///
Note that you can only access Hits from an IndexSearcher as long as it is
/// not yet closed, otherwise an IOException will be thrown.
///
public class IndexSearcher : Searcher
{
private class AnonymousClassHitCollector : HitCollector
{
public AnonymousClassHitCollector(System.Collections.BitArray bits, Lucene.Net.Search.HitCollector results, IndexSearcher enclosingInstance)
{
InitBlock(bits, results, enclosingInstance);
}
private void InitBlock(System.Collections.BitArray bits, Lucene.Net.Search.HitCollector results, IndexSearcher enclosingInstance)
{
this.bits = bits;
this.results = results;
this.enclosingInstance = enclosingInstance;
}
private System.Collections.BitArray bits;
private Lucene.Net.Search.HitCollector results;
private IndexSearcher enclosingInstance;
public IndexSearcher Enclosing_Instance
{
get
{
return enclosingInstance;
}
}
public override void Collect(int doc, float score)
{
if (bits.Get(doc))
{
// skip docs not in bits
results.Collect(doc, score);
}
}
}
internal IndexReader reader;
private bool closeReader;
public IndexReader Reader
{
get { return reader; }
}
///