/// <summary>Skips to the first match beyond the current whose document number is /// greater than or equal to a given target. /// <br>When this method is used the {@link #Explain(int)} method should not be used. /// </summary> /// <param name="target">The target document number. /// </param> /// <returns> true iff there is such a match. /// </returns> public override bool SkipTo(int target) { if (firstTime) { firstTime = false; if (!exclScorer.SkipTo(target)) { exclScorer = null; // exhausted } } if (reqScorer == null) { return(false); } if (exclScorer == null) { return(reqScorer.SkipTo(target)); } if (!reqScorer.SkipTo(target)) { reqScorer = null; return(false); } return(ToNonExcluded()); }
/// <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); }
/// <summary>Skips to the first match beyond the current whose document number is /// greater than or equal to a given target. /// <br>When this method is used the {@link #Explain(int)} method should not be used. /// <br>The implementation uses the skipTo() method on the subscorers. /// </summary> /// <param name="target">The target document number. /// </param> /// <returns> true iff there is such a match. /// </returns> public override bool SkipTo(int target) { if (scorerQueue == null) { InitScorerQueue(); } if (scorerQueue.Size() < minimumNrMatchers) { return(false); } if (target <= currentDoc) { target = currentDoc + 1; } do { Scorer top = (Scorer)scorerQueue.Top(); if (top.Doc() >= target) { return(AdvanceAfterCurrent()); } else if (top.SkipTo(target)) { scorerQueue.AdjustTop(); } else { scorerQueue.Pop(); if (scorerQueue.Size() < minimumNrMatchers) { return(false); } } }while (true); }
/// <summary>Skips to the first match beyond the current whose document number is /// greater than or equal to a given target. /// /// <p>When this method is used the {@link #Explain(int)} method should not be used. /// /// </summary> /// <param name="target">The target document number. /// </param> /// <returns> true iff there is such a match. /// </returns> public override bool SkipTo(int target) { if (countingSumScorer == null) { InitCountingSumScorer(); } return(countingSumScorer.SkipTo(target)); }
// 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); } } } }
public override bool SkipTo(int docNr) { return(scorer.SkipTo(docNr)); }
public override bool SkipTo(int target) { return(reqScorer.SkipTo(target)); }