本文整理汇总了C#中Lucene.Net.Search.Scorer类的典型用法代码示例。如果您正苦于以下问题:C# Scorer类的具体用法?C# Scorer怎么用?C# Scorer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Scorer类属于Lucene.Net.Search命名空间,在下文中一共展示了Scorer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetScorer
public override void SetScorer(Scorer scorer)
{
foreach (DocComparator comparator in _comparators)
{
comparator.SetScorer(scorer);
}
}
示例2: DisjunctionScorer
protected internal DisjunctionScorer(Weight weight, Scorer[] subScorers)
: base(weight)
{
this.SubScorers = subScorers;
this.NumScorers = subScorers.Length;
Heapify();
}
示例3: Next
public override bool Next()
{
if (firstTime)
{
if (!exclScorer.Next())
{
exclScorer = null; // exhausted at start
}
firstTime = false;
}
if (reqScorer == null)
{
return false;
}
if (!reqScorer.Next())
{
reqScorer = null; // exhausted, nothing left
return false;
}
if (exclScorer == null)
{
return true; // reqScorer.next() already returned true
}
return ToNonExcluded();
}
示例4: CreateScorer
public virtual Scorer CreateScorer(Scorer innerScorer, IndexReader reader, bool scoreDocsInOrder, bool topScorer)
{
if(!(reader is BoboIndexReader))
throw new ArgumentException("IndexReader is not BoboIndexReader");
return new FacetBasedBoostingScorer(this, (BoboIndexReader)reader, innerScorer.Similarity, innerScorer);
}
示例5: ReqExclScorer
/// <summary>Construct a <code>ReqExclScorer</code>.</summary>
/// <param name="reqScorer">The scorer that must match, except where
/// </param>
/// <param name="exclScorer">indicates exclusion.
/// </param>
public ReqExclScorer(Scorer reqScorer, Scorer exclScorer)
: base(null)
{
// No similarity used.
this.reqScorer = reqScorer;
this.exclScorer = exclScorer;
}
示例6: AssertingScorer
private AssertingScorer(Random random, Scorer @in)
: base(@in.Weight)
{
this.Random = random;
[email protected] = @in;
this.DocsEnumIn = new AssertingAtomicReader.AssertingDocsEnum(@in);
}
示例7: ReqExclScorer
/// <summary>Construct a <code>ReqExclScorer</code>.</summary>
/// <param name="reqScorer">The scorer that must match, except where
/// </param>
/// <param name="exclDisi">indicates exclusion.
/// </param>
public ReqExclScorer(Scorer reqScorer, DocIdSetIterator exclDisi)
: base(null)
{
// No similarity used.
this.reqScorer = reqScorer;
this.exclDisi = exclDisi;
}
示例8: ReqOptSumScorer
/// <summary>Construct a <code>ReqOptScorer</code>.</summary>
/// <param name="reqScorer">The required scorer. This must match.
/// </param>
/// <param name="optScorer">The optional scorer. This is used for scoring only.
/// </param>
public ReqOptSumScorer(Scorer reqScorer, Scorer optScorer)
: base(null)
{
// No similarity used.
this.reqScorer = reqScorer;
this.optScorer = optScorer;
}
示例9: SetScorer
public override void SetScorer(Scorer scorer)
{
// Set a ScoreCachingWrappingScorer in case the wrapped Collector will call
// score() also.
this.scorer = new ScoreCachingWrappingScorer(scorer);
c.SetScorer(this.scorer);
}
示例10: Score
/// <summary>Returns the score of the current document matching the query.
/// Initially invalid, until {@link #Next()} is called the first time.
/// </summary>
/// <returns> The score of the required scorer, eventually increased by the score
/// of the optional scorer when it also matches the current document.
/// </returns>
public override float Score()
{
int curDoc = reqScorer.Doc();
float reqScore = reqScorer.Score();
if (firstTimeOptScorer)
{
firstTimeOptScorer = false;
if (!optScorer.SkipTo(curDoc))
{
optScorer = null;
return reqScore;
}
}
else if (optScorer == null)
{
return reqScore;
}
else if ((optScorer.Doc() < curDoc) && (!optScorer.SkipTo(curDoc)))
{
optScorer = null;
return reqScore;
}
// assert (optScorer != null) && (optScorer.doc() >= curDoc);
return (optScorer.Doc() == curDoc)?reqScore + optScorer.Score():reqScore;
}
示例11: SetScorer
public override void SetScorer(Scorer _scorer)
{
this.scorer = _scorer;
for (int i = 0; i < hitQueue.comparators.Length; i++)
{
hitQueue.comparators[i].SetScorer(_scorer);
}
}
示例12: ReqOptSumScorer
/// <summary>
/// Construct a <code>ReqOptScorer</code>. </summary>
/// <param name="reqScorer"> The required scorer. this must match. </param>
/// <param name="optScorer"> The optional scorer. this is used for scoring only. </param>
public ReqOptSumScorer(Scorer reqScorer, Scorer optScorer)
: base(reqScorer.weight)
{
Debug.Assert(reqScorer != null);
Debug.Assert(optScorer != null);
this.ReqScorer = reqScorer;
this.OptScorer = optScorer;
}
示例13: Add
/// <summary>Add the scorer for a subquery</summary>
/// <param name="scorer">the scorer of a subquery of our associated DisjunctionMaxQuery
/// </param>
public virtual void Add(Scorer scorer)
{
if (scorer.Next())
{
// Initialize and retain only if it produces docs
subScorers.Add(scorer);
more = true;
}
}
示例14: SubScorer
public SubScorer(Scorer scorer, bool required, bool prohibited, HitCollector collector, SubScorer next)
{
this.scorer = scorer;
this.done = !scorer.Next();
this.required = required;
this.prohibited = prohibited;
this.collector = collector;
this.next = next;
}
示例15: ConjunctionScorer
public ConjunctionScorer(Similarity similarity, Scorer[] scorers)
: base(similarity)
{
this.scorers = scorers;
coord = similarity.Coord(scorers.Length, scorers.Length);
for (int i = 0; i < scorers.Length; i++)
{
if (scorers[i].NextDoc() == NO_MORE_DOCS)
{
// If even one of the sub-scorers does not have any documents, this
// scorer should not attempt to do any more work.
lastDoc = NO_MORE_DOCS;
return ;
}
}
// Sort the array the first time...
// We don't need to sort the array in any future calls because we know
// it will already start off sorted (all scorers on same doc).
// note that this comparator is not consistent with equals!
System.Array.Sort(scorers, new AnonymousClassComparator(this));
// NOTE: doNext() must be called before the re-sorting of the array later on.
// The reason is this: assume there are 5 scorers, whose first docs are 1,
// 2, 3, 5, 5 respectively. Sorting (above) leaves the array as is. Calling
// doNext() here advances all the first scorers to 5 (or a larger doc ID
// they all agree on).
// However, if we re-sort before doNext() is called, the order will be 5, 3,
// 2, 1, 5 and then doNext() will stop immediately, since the first scorer's
// docs equals the last one. So the invariant that after calling doNext()
// all scorers are on the same doc ID is broken.
if (DoNext() == NO_MORE_DOCS)
{
// The scorers did not agree on any document.
lastDoc = NO_MORE_DOCS;
return ;
}
// If first-time skip distance is any predictor of
// scorer sparseness, then we should always try to skip first on
// those scorers.
// Keep last scorer in it's last place (it will be the first
// to be skipped on), but reverse all of the others so that
// they will be skipped on in order of original high skip.
int end = scorers.Length - 1;
int max = end >> 1;
for (int i = 0; i < max; i++)
{
Scorer tmp = scorers[i];
int idx = end - i - 1;
scorers[i] = scorers[idx];
scorers[idx] = tmp;
}
}