本文整理汇总了C#中Lucene.Net.Search.HitCollector.Collect方法的典型用法代码示例。如果您正苦于以下问题:C# HitCollector.Collect方法的具体用法?C# HitCollector.Collect怎么用?C# HitCollector.Collect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lucene.Net.Search.HitCollector
的用法示例。
在下文中一共展示了HitCollector.Collect方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Score
protected internal override bool Score(HitCollector c, int end)
{
Similarity similarity = GetSimilarity(); // cache sim in local
float[] normDecoder = Similarity.GetNormDecoder();
while (doc < end)
{
// for docs in window
int f = freqs[pointer];
float score = f < SCORE_CACHE_SIZE ? scoreCache[f] : similarity.Tf(f) * weightValue; // cache miss
score *= normDecoder[norms[doc] & 0xFF]; // normalize for field
c.Collect(doc, score); // 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;
}
示例2: Score
/// <summary>Scores and collects all matching documents.</summary>
/// <param name="hc">The collector to which all matching documents are passed through
/// {@link HitCollector#Collect(int, float)}.
/// <br>When this method is used the {@link #Explain(int)} method should not be used.
/// </param>
public virtual void Score(HitCollector hc)
{
while (Next())
{
hc.Collect(Doc(), Score());
}
}
示例3: Score
/// <summary>Expert: Collects matching documents in a range.
/// <br>Note that {@link #Next()} must be called once before this method is
/// called for the first time.
/// </summary>
/// <param name="hc">The collector to which all matching documents are passed through
/// {@link HitCollector#Collect(int, float)}.
/// </param>
/// <param name="max">Do not score documents past this.
/// </param>
/// <returns> true if more matching documents may remain.
/// </returns>
protected internal override bool Score(HitCollector hc, int max)
{
// null pointer exception when Next() was not called before:
int docNr = countingSumScorer.Doc();
while (docNr < max)
{
hc.Collect(docNr, Score());
if (!countingSumScorer.Next())
{
return false;
}
docNr = countingSumScorer.Doc();
}
return true;
}
示例4: Score
/// <summary>Scores and collects all matching documents.</summary>
/// <param name="hc">The collector to which all matching documents are passed through
/// {@link HitCollector#Collect(int, float)}.
/// <br>When this method is used the {@link #Explain(int)} method should not be used.
/// </param>
public override void Score(HitCollector hc)
{
if (allowDocsOutOfOrder && requiredScorers.Count == 0 && prohibitedScorers.Count < 32)
{
// fall back to BooleanScorer, scores documents somewhat out of order
BooleanScorer bs = new BooleanScorer(GetSimilarity(), minNrShouldMatch);
System.Collections.IEnumerator si = optionalScorers.GetEnumerator();
while (si.MoveNext())
{
bs.Add((Scorer) si.Current, false, false);
}
si = prohibitedScorers.GetEnumerator();
while (si.MoveNext())
{
bs.Add((Scorer) si.Current, false, true);
}
bs.Score(hc);
}
else
{
if (countingSumScorer == null)
{
InitCountingSumScorer();
}
while (countingSumScorer.Next())
{
hc.Collect(countingSumScorer.Doc(), Score());
}
}
}
示例5: Score
protected internal override bool Score(HitCollector hc, int max)
{
if (coordFactors == null)
ComputeCoordFactors();
bool more;
Bucket tmp;
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;
}
hc.Collect(current.doc, current.score * coordFactors[current.coord]);
}
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)
{
if (!sub.done)
{
sub.done = !sub.scorer.Score(sub.collector, end);
if (!sub.done)
more = true;
}
}
current = bucketTable.first;
}
while (current != null || more);
return false;
}
示例6: Search
// inherit javadoc
public override void Search(Weight weight, Filter filter, HitCollector results)
{
Scorer scorer = weight.Scorer(reader);
if (scorer == null)
return;
if (filter == null)
{
scorer.Score(results);
return;
}
DocIdSetIterator filterDocIdIterator = filter.GetDocIdSet(reader).Iterator(); // CHECKME: use ConjunctionScorer here?
bool more = filterDocIdIterator.Next() && scorer.SkipTo(filterDocIdIterator.Doc());
while (more)
{
int filterDocId = filterDocIdIterator.Doc();
if (filterDocId > scorer.Doc() && !scorer.SkipTo(filterDocId))
{
more = false;
}
else
{
int scorerDocId = scorer.Doc();
if (scorerDocId == filterDocId) // permitted by filter
{
results.Collect(scorerDocId, scorer.Score());
more = filterDocIdIterator.Next();
}
else
{
more = filterDocIdIterator.SkipTo(scorerDocId);
}
}
}
}
示例7: Score
/// <summary>Expert: Collects matching documents in a range. Hook for optimization.
/// Note that {@link #Next()} must be called once before this method is called
/// for the first time.
/// </summary>
/// <param name="hc">The collector to which all matching documents are passed through
/// {@link HitCollector#Collect(int, float)}.
/// </param>
/// <param name="max">Do not score documents past this.
/// </param>
/// <returns> true if more matching documents may remain.
/// </returns>
protected internal override bool Score(HitCollector hc, int max)
{
while (currentDoc < max)
{
hc.Collect(currentDoc, currentScore);
if (!Next())
{
return false;
}
}
return true;
}