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); } }
public virtual void TestSpanNearScorerSkipTo1() { SpanNearQuery q = MakeQuery(); Weight w = q.Weight(searcher); Scorer s = w.Scorer(searcher.GetIndexReader(), true, false); Assert.AreEqual(1, s.Advance(1)); }
public override int Advance(int target) { int doc = subQueryScorer.Advance(target); if (doc != NO_MORE_DOCS) { for (int i = 0; i < valSrcScorers.Length; i++) { valSrcScorers[i].Advance(doc); } } return(doc); }
private int AdvanceToCommon(int scorerDoc, int disiDoc) { while (scorerDoc != disiDoc) { if (scorerDoc < disiDoc) { scorerDoc = scorer.Advance(disiDoc); } else { disiDoc = docIdSetIterator.Advance(scorerDoc); } } return(scorerDoc); }