public virtual void TestSpanScorerZeroSloppyFreq() { bool ordered = true; int slop = 1; Similarity sim = new AnonymousClassDefaultSimilarity(this); SpanNearQuery snq = new AnonymousClassSpanNearQuery(sim, this, new SpanQuery[] { MakeSpanTermQuery("t1"), MakeSpanTermQuery("t2") }, slop, ordered); Scorer spanScorer = snq.Weight(searcher).Scorer(searcher.GetIndexReader(), true, false); Assert.IsTrue(spanScorer.NextDoc() != DocIdSetIterator.NO_MORE_DOCS, "first doc"); Assert.AreEqual(spanScorer.DocID(), 11, "first doc number"); float score = spanScorer.Score(); Assert.IsTrue(score == 0.0f, "first doc score should be zero, " + score); Assert.IsTrue(spanScorer.NextDoc() == DocIdSetIterator.NO_MORE_DOCS, "no second doc"); }
public override int NextDoc() { int doc = subQueryScorer.NextDoc(); if (doc != NO_MORE_DOCS) { for (int i = 0; i < valSrcScorers.Length; i++) { valSrcScorers[i].Advance(doc); } } return(doc); }
public override int NextDoc() { int scorerDoc, disiDoc; return(doc = (disiDoc = docIdSetIterator.NextDoc()) != NO_MORE_DOCS && (scorerDoc = scorer.NextDoc()) != NO_MORE_DOCS && AdvanceToCommon(scorerDoc, disiDoc) != NO_MORE_DOCS?scorer.DocID() : NO_MORE_DOCS); }
public override void Collect(int doc) { doc = doc + base_Renamed; float score = sc.Score(); try { int op = order[(opidx[0]++) % order.Length]; // System.out.println(op==skip_op ? // "skip("+(sdoc[0]+1)+")":"next()"); bool more = op == skip_op?scorer.Advance(sdoc[0] + 1) != DocIdSetIterator.NO_MORE_DOCS : scorer.NextDoc() != DocIdSetIterator.NO_MORE_DOCS; sdoc[0] = scorer.DocID(); float scorerScore = scorer.Score(); float scorerScore2 = scorer.Score(); float scoreDiff = System.Math.Abs(score - scorerScore); float scorerDiff = System.Math.Abs(scorerScore2 - scorerScore); if (!more || doc != sdoc[0] || scoreDiff > maxDiff || scorerDiff > maxDiff) { System.Text.StringBuilder sbord = new System.Text.StringBuilder(); for (int i = 0; i < order.Length; i++) { sbord.Append(order[i] == skip_op?" skip()":" next()"); } throw new System.SystemException("ERROR matching docs:" + "\n\t" + (doc != sdoc[0]?"--> ":"") + "doc=" + sdoc[0] + "\n\t" + (!more?"--> ":"") + "tscorer.more=" + more + "\n\t" + (scoreDiff > maxDiff?"--> ":"") + "scorerScore=" + scorerScore + " scoreDiff=" + scoreDiff + " maxDiff=" + maxDiff + "\n\t" + (scorerDiff > maxDiff?"--> ":"") + "scorerScore2=" + scorerScore2 + " scorerDiff=" + scorerDiff + "\n\thitCollector.doc=" + doc + " score=" + score + "\n\t Scorer=" + scorer + "\n\t Query=" + q + " " + q.GetType().FullName + "\n\t Searcher=" + s + "\n\t Order=" + sbord + "\n\t Op=" + (op == skip_op?" skip()":" next()")); } } catch (System.IO.IOException e) { throw new System.SystemException("", e); } }