本文整理汇总了C#中Lucene.Net.Search.Collector类的典型用法代码示例。如果您正苦于以下问题:C# Collector类的具体用法?C# Collector怎么用?C# Collector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Collector类属于Lucene.Net.Search命名空间,在下文中一共展示了Collector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AssertingCollector
internal AssertingCollector(Random random, Collector @in, bool inOrder)
{
this.Random = random;
[email protected] = @in;
this.InOrder = inOrder;
LastCollected = -1;
}
示例2: TimeLimitingCollector
/// <summary> Create a TimeLimitedCollector wrapper over another <see cref="Collector" /> with a specified timeout.</summary>
/// <param name="collector">the wrapped <see cref="Collector" />
/// </param>
/// <param name="timeAllowed">max time allowed for collecting hits after which <see cref="TimeExceededException" /> is thrown
/// </param>
public TimeLimitingCollector(Collector collector, long timeAllowed)
{
InitBlock();
this.collector = collector;
t0 = TIMER_THREAD.GetMilliseconds();
this.timeout = t0 + timeAllowed;
}
示例3: SearchWithFilter
private void SearchWithFilter(IndexReader reader, Weight weight, Filter filter, Collector collector)
{
DocIdSet docIdSet = filter.GetDocIdSet(reader);
if (docIdSet == null)
return;
Scorer scorer = weight.Scorer(reader, true, false);
if (scorer == null)
return;
scorer.DocID();
DocIdSetIterator docIdSetIterator = docIdSet.Iterator();
if (docIdSetIterator == null)
return;
int target = docIdSetIterator.NextDoc();
int num = scorer.Advance(target);
collector.SetScorer(scorer);
while (true)
{
while (num != target)
{
if (num > target)
target = docIdSetIterator.Advance(num);
else
num = scorer.Advance(target);
}
if (num != DocIdSetIterator.NO_MORE_DOCS && !((GroupCollector)collector).GroupLimitReached)
{
collector.Collect(num);
target = docIdSetIterator.NextDoc();
num = scorer.Advance(target);
}
else
break;
}
}
示例4: Score
public override bool Score(Collector collector, int max)
{
RandomOrderCollector randomCollector = new RandomOrderCollector(Random, collector);
bool remaining = @in.Score(randomCollector, max);
randomCollector.Flush();
return remaining;
}
示例5: Score
// 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;
}
示例6: Score
/// <summary>Scores and collects all matching documents.</summary>
/// <param name="collector">The collector to which all matching documents are passed.
/// <br/>When this method is used the {@link #Explain(int)} method should not be used.
/// </param>
public virtual void Score(Collector collector)
{
collector.SetScorer(this);
int doc;
while ((doc = NextDoc()) != NO_MORE_DOCS)
{
collector.Collect(doc);
}
}
示例7: RandomOrderCollector
internal RandomOrderCollector(Random random, Collector @in)
{
if ([email protected]())
{
throw new System.ArgumentException();
}
[email protected] = @in;
this.Random = random;
BufferSize = 1 + random.Next(100);
DocIDs = new int[BufferSize];
Scores = new float[BufferSize];
Freqs = new int[BufferSize];
Buffered = 0;
}
示例8: CachingCollector
// Prevent extension from non-internal classes
private CachingCollector(Collector other, double maxRAMMB, bool cacheScores)
{
this.Other = other;
CachedDocs = new List<int[]>();
CurDocs = new int[INITIAL_ARRAY_SIZE];
CachedDocs.Add(CurDocs);
int bytesPerDoc = RamUsageEstimator.NUM_BYTES_INT;
if (cacheScores)
{
bytesPerDoc += RamUsageEstimator.NUM_BYTES_FLOAT;
}
MaxDocsToCache = (int)((maxRAMMB * 1024 * 1024) / bytesPerDoc);
}
示例9: Score
public override void Score(Collector collector)
{
if (Random.NextBoolean())
{
try
{
bool remaining = @in.Score(collector, DocsEnum.NO_MORE_DOCS);
Debug.Assert(!remaining);
}
catch (System.NotSupportedException e)
{
@in.Score(collector);
}
}
else
{
@in.Score(collector);
}
}
示例10: Search
public override void Search(Weight weight, Filter filter, Collector collector)
{
if (filter == null)
{
for (int index = 0; index < this.subReaders.Length; ++index)
{
collector.SetNextReader(this.subReaders[index], this.docStarts[index]);
Scorer scorer = weight.Scorer(this.subReaders[index], !collector.AcceptsDocsOutOfOrder, true);
if (scorer != null)
this.SearchWithScorer(this.subReaders[index], weight, scorer, collector);
}
}
else
{
for (int index = 0; index < this.subReaders.Length; ++index)
{
collector.SetNextReader(this.subReaders[index], this.docStarts[index]);
this.SearchWithFilter(this.subReaders[index], weight, filter, collector);
}
}
}
示例11: Score
/// <summary>Scores and collects all matching documents.</summary>
/// <param name="collector">The collector to which all matching documents are passed through.
/// <br/>When this method is used the <see cref="Explain(int)" /> method should not be used.
/// </param>
public override void Score(Collector collector)
{
collector.SetScorer(this);
while (NextDoc() != NO_MORE_DOCS)
{
collector.Collect(currentDoc);
}
}
示例12: Score
public /*protected internal*/ override bool Score(Collector collector, int max, int firstDocID)
{
throw new System.NotSupportedException(Lucene.Net.Search.JustCompileSearch.UNSUPPORTED_MSG);
}
示例13: Search
public override void Search(Query query, Filter filter, Collector results)
{
throw new System.NotSupportedException(Lucene.Net.Search.JustCompileSearch.UNSUPPORTED_MSG);
}
示例14: Search
/// <summary>Lower-level search API.
///
/// <p/><see cref="Collector.Collect(int)" /> is called for every matching document.
///
/// <p/>Applications should only use this if they need <i>all</i> of the matching
/// documents. The high-level search API (<see cref="Searcher.Search(Query, int)" />
/// ) is usually more efficient, as it skips non-high-scoring hits.
/// <p/>Note: The <c>score</c> passed to this method is a raw score.
/// In other words, the score will not necessarily be a float whose value is
/// between 0 and 1.
/// </summary>
/// <throws> BooleanQuery.TooManyClauses </throws>
public virtual void Search(Query query, Collector results)
{
Search(CreateWeight(query), null, results);
}
示例15: Search
public override void Search(Weight weight, Filter filter, Collector results)
{
throw new System.NotSupportedException();
}