/// <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) { while (Next()) { hc.Collect(currentDoc, currentScore); } }
/// <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()); } }
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); }
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; }
/// <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()); } } }
/// <summary> Calls collect() on the decorated HitCollector. /// /// </summary> /// <throws> TimeExceededException if the time allowed has been exceeded. </throws> public override void Collect(int doc, float score) { long time = TIMER_THREAD.GetMilliseconds(); if (timeout < time) { if (greedy) { //System.out.println(this+" greedy: before failing, collecting doc: "+doc+" "+(time-t0)); hc.Collect(doc, score); } //System.out.println(this+" failing on: "+doc+" "+(time-t0)); throw new TimeExceededException(timeout - t0, time - t0, doc); } //System.out.println(this+" collecting: "+doc+" "+(time-t0)); hc.Collect(doc, 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 virtual bool Score(HitCollector hc, int max) { while (Doc() < max) { hc.Collect(Doc(), Score()); if (!Next()) return false; } return true; }
/// <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 (countingSumScorer == null) { InitCountingSumScorer(); } while (countingSumScorer.Next()) { hc.Collect(countingSumScorer.Doc(), 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 virtual bool Score(HitCollector hc, int max) { while (Doc() < max) { hc.Collect(Doc(), Score()); if (!Next()) { return(false); } } return(true); }
/// <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); }
/// <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); }
// 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); } } } }
/// <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; }
/// <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; }
public override void Collect(int doc) { collector.Collect(doc + base_Renamed, scorer.Score()); }
// 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); } } } }
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; }
/// <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()); } } }
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); }