public override float Score() { float rawScore = _innerScorer.Score(); long timeVal = (long)_termList.GetRawValue(_orderArray.Get(_innerScorer.DocID())); float timeScore = _parent.ComputeTimeFactor(timeVal); return(RecencyBoostScorerBuilder.CombineScores(timeScore, rawScore)); }
public override float Score() { int doc = scorer.DocID(); if (doc != curDoc) { curScore = scorer.Score(); curDoc = doc; } return(curScore); }
/// <summary>Advance to non excluded doc. /// <br/>On entry: /// <list type="bullet"> /// <item>reqScorer != null, </item> /// <item>exclScorer != null, </item> /// <item>reqScorer was advanced once via next() or skipTo() /// and reqScorer.doc() may still be excluded.</item> /// </list> /// Advances reqScorer a non excluded required doc, if any. /// </summary> /// <returns> true iff there is a non excluded required doc. /// </returns> private int ToNonExcluded() { int exclDoc = exclDisi.DocID(); int reqDoc = reqScorer.DocID(); // may be excluded do { if (reqDoc < exclDoc) { return(reqDoc); // reqScorer advanced to before exclScorer, ie. not excluded } else if (reqDoc > exclDoc) { exclDoc = exclDisi.Advance(reqDoc); if (exclDoc == NO_MORE_DOCS) { exclDisi = null; // exhausted, no more exclusions return(reqDoc); } if (exclDoc > reqDoc) { return(reqDoc); // not excluded } } }while ((reqDoc = reqScorer.NextDoc()) != NO_MORE_DOCS); reqScorer = null; // exhausted, nothing left return(NO_MORE_DOCS); }
public override double DoubleVal(int document) { Debug.Assert(document == scorer.DocID()); var score = scorer.Score(); Console.WriteLine("Score = {0}", score); return(score); }
protected internal override void AfterNext() { Scorer sub = SubScorers[0]; Doc = sub.DocID(); if (Doc != NO_MORE_DOCS) { score = sub.Score(); NrMatchers = 1; CountMatches(1); CountMatches(2); } }
/* The subtree of subScorers at root is a min heap except possibly for its root element. * Bubble the root down as required to make the subtree a heap. */ private void HeapAdjust(int root) { Scorer scorer = subScorers[root]; int doc = scorer.DocID(); int i = root; while (i <= (numScorers >> 1) - 1) { int lchild = (i << 1) + 1; Scorer lscorer = subScorers[lchild]; int ldoc = lscorer.DocID(); int rdoc = System.Int32.MaxValue, rchild = (i << 1) + 2; Scorer rscorer = null; if (rchild < numScorers) { rscorer = subScorers[rchild]; rdoc = rscorer.DocID(); } if (ldoc < doc) { if (rdoc < ldoc) { subScorers[i] = rscorer; subScorers[rchild] = scorer; i = rchild; } else { subScorers[i] = lscorer; subScorers[lchild] = scorer; i = lchild; } } else if (rdoc < doc) { subScorers[i] = rscorer; subScorers[rchild] = scorer; i = rchild; } else { return; } } }
/// <summary>Returns the score of the current document matching the query. /// Initially invalid, until <see cref="NextDoc()" /> 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.DocID(); float reqScore = reqScorer.Score(); if (optScorer == null) { return(reqScore); } int optScorerDoc = optScorer.DocID(); if (optScorerDoc < curDoc && (optScorerDoc = optScorer.Advance(curDoc)) == NO_MORE_DOCS) { optScorer = null; return(reqScore); } return(optScorerDoc == curDoc?reqScore + optScorer.Score():reqScore); }
/// <summary> Adds a Scorer to the ScorerDocQueue in log(size) time if either /// the ScorerDocQueue is not full, or not lessThan(scorer, top()). /// </summary> /// <param name="scorer"> /// </param> /// <returns> true if scorer is added, false otherwise. /// </returns> public virtual bool Insert(Scorer scorer) { if (size < maxSize) { Put(scorer); return(true); } else { int docNr = scorer.DocID(); if ((size > 0) && (!(docNr < topHSD.doc))) { // heap[1] is top() heap[1] = new HeapedScorerDoc(this, scorer, docNr); DownHeap(); return(true); } else { return(false); } } }
public override int DocID() { return(subQueryScorer.DocID()); }
public override int DocID() { return(scorer.DocID()); }
internal virtual void Adjust() { doc = scorer.DocID(); }
internal HeapedScorerDoc(ScorerDocQueue enclosingInstance, Scorer s) : this(enclosingInstance, s, s.DocID()) { }