本文整理汇总了C#中Lucene.Net.Search.Collector类的典型用法代码示例。如果您正苦于以下问题:C# Collector类的具体用法?C# Collector怎么用?C# Collector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Collector类属于Lucene.Net.Search命名空间,在下文中一共展示了Collector类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AssertingCollector
internal AssertingCollector(Random random, Collector @in, bool inOrder)
{
this.Random = random;
[email protected] = @in;
this.InOrder = inOrder;
LastCollected = -1;
}
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:7,代码来源:AssertingCollector.cs
示例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;
}
开发者ID:sinsay,项目名称:SSE,代码行数:12,代码来源:TimeLimitingCollector.cs
示例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;
}
}
开发者ID:NHSChoices,项目名称:location-service,代码行数:35,代码来源:GroupedIndexSearcher.cs
示例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;
}
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:7,代码来源:AssertingBulkOutOfOrderScorer.cs
示例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;
}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:27,代码来源:TermScorer.cs
示例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);
}
}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:13,代码来源:Scorer.cs
示例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;
}
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:14,代码来源:RandomOrderCollector.cs
示例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);
}
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:16,代码来源:CachingCollector.cs
示例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);
}
}
开发者ID:WakeflyCBass,项目名称:lucenenet,代码行数:19,代码来源:AssertingBulkScorer.cs
示例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);
}
}
}
开发者ID:NHSChoices,项目名称:location-service,代码行数:21,代码来源:GroupedIndexSearcher.cs
示例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);
}
}
开发者ID:synhershko,项目名称:lucene.net,代码行数:12,代码来源:DisjunctionSumScorer.cs
示例12: Score
public /*protected internal*/ override bool Score(Collector collector, int max, int firstDocID)
{
throw new System.NotSupportedException(Lucene.Net.Search.JustCompileSearch.UNSUPPORTED_MSG);
}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:4,代码来源:JustCompileSearch.cs
示例13: Search
public override void Search(Query query, Filter filter, Collector results)
{
throw new System.NotSupportedException(Lucene.Net.Search.JustCompileSearch.UNSUPPORTED_MSG);
}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:4,代码来源:JustCompileSearch.cs
示例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);
}
开发者ID:synhershko,项目名称:lucene.net,代码行数:16,代码来源:Searcher.cs
示例15: Search
public override void Search(Weight weight, Filter filter, Collector results)
{
throw new System.NotSupportedException();
}
开发者ID:sinsay,项目名称:SSE,代码行数:4,代码来源:MultiSearcher.cs
示例16: SearchWithFilter
private void SearchWithFilter(IndexReader reader, Weight weight, Filter filter, Collector collector)
{
System.Diagnostics.Debug.Assert(filter != null);
Scorer scorer = weight.Scorer(reader, true, false);
if (scorer == null)
{
return ;
}
int docID = scorer.DocID();
System.Diagnostics.Debug.Assert(docID == - 1 || docID == DocIdSetIterator.NO_MORE_DOCS);
// CHECKME: use ConjunctionScorer here?
DocIdSet filterDocIdSet = filter.GetDocIdSet(reader);
if (filterDocIdSet == null)
{
// this means the filter does not accept any documents.
return ;
}
DocIdSetIterator filterIter = filterDocIdSet.Iterator();
if (filterIter == null)
{
// this means the filter does not accept any documents.
return ;
}
int filterDoc = filterIter.NextDoc();
int scorerDoc = scorer.Advance(filterDoc);
collector.SetScorer(scorer);
while (true)
{
if (scorerDoc == filterDoc)
{
// Check if scorer has exhausted, only before collecting.
if (scorerDoc == DocIdSetIterator.NO_MORE_DOCS)
{
break;
}
collector.Collect(scorerDoc);
filterDoc = filterIter.NextDoc();
scorerDoc = scorer.Advance(filterDoc);
}
else if (scorerDoc > filterDoc)
{
filterDoc = filterIter.Advance(scorerDoc);
}
else
{
scorerDoc = scorer.Advance(filterDoc);
}
}
}
开发者ID:sinsay,项目名称:SSE,代码行数:54,代码来源:IndexSearcher.cs
示例17: SubScorer
public SubScorer(Scorer scorer, bool required, bool prohibited, Collector collector, SubScorer next)
{
this.scorer = scorer;
this.required = required;
this.prohibited = prohibited;
this.collector = collector;
this.next = next;
}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:8,代码来源:BooleanScorer.cs
示例18: Score
// firstDocID is ignored since nextDoc() initializes 'current'
public /*protected internal*/ override bool Score(Collector collector, int max, int firstDocID)
{
bool more;
Bucket tmp;
BucketScorer bs = new BucketScorer();
// The internal loop will set the score and doc before calling collect.
collector.SetScorer(bs);
do
{
bucketTable.first = null;
while (current != null)
{
// more queued
// check prohibited & required
if ((current.bits & prohibitedMask) == 0 && (current.bits & requiredMask) == requiredMask)
{
if (current.doc >= max)
{
tmp = current;
current = current.next;
tmp.next = bucketTable.first;
bucketTable.first = tmp;
continue;
}
if (current.coord >= minNrShouldMatch)
{
bs.score = current.score * coordFactors[current.coord];
bs.doc = current.doc;
collector.Collect(current.doc);
}
}
current = current.next; // pop the queue
}
if (bucketTable.first != null)
{
current = bucketTable.first;
bucketTable.first = current.next;
return true;
}
// refill the queue
more = false;
end += BucketTable.SIZE;
for (SubScorer sub = scorers; sub != null; sub = sub.next)
{
int subScorerDocID = sub.scorer.DocID();
if (subScorerDocID != NO_MORE_DOCS)
{
more |= sub.scorer.Score(sub.collector, end, subScorerDocID);
}
}
current = bucketTable.first;
}
while (current != null || more);
return false;
}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:64,代码来源:BooleanScorer.cs
示例19: PositiveScoresOnlyCollector
public PositiveScoresOnlyCollector(Collector c)
{
this.c = c;
}
开发者ID:BackupTheBerlios,项目名称:lyra2-svn,代码行数:4,代码来源:PositiveScoresOnlyCollector.cs
示例20: CountingCollector
public CountingCollector(Collector other, ISet<string> relationships)
{
this.Other = other;
this.Relationships = relationships;
}
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:5,代码来源:TestSubScorerFreqs.cs
注:本文中的Lucene.Net.Search.Collector类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论