VerifyExplanation() public static method

Assert that an explanation has the expected score, and optionally that its sub-details max/sum/factor match to that score.
public static VerifyExplanation ( string q, int doc, float score, bool deep, Explanation expl ) : void
q string String representation of the query for assertion messages
doc int Document ID for assertion messages
score float Real score value of doc with query q
deep bool indicates whether a deep comparison of sub-Explanation details should be executed
expl Explanation The Explanation to match against score
return void
Beispiel #1
0
        public virtual void Collect(int doc)
        {
            Explanation exp = null;

            doc = doc + @base;
            try
            {
                exp = s.Explain(q, doc);
            }
            catch (IOException e)
            {
                throw new Exception("exception in hitcollector of [[" + d + "]] for #" + doc, e);
            }

            Assert.IsNotNull(exp, "Explanation of [[" + d + "]] for #" + doc + " is null");
            CheckHits.VerifyExplanation(d, doc, scorer.GetScore(), deep, exp);
            Assert.IsTrue(exp.IsMatch, "Explanation of [[" + d + "]] for #" + doc + " does not indicate match: " + exp.ToString());
        }
Beispiel #2
0
        public virtual void Collect(int doc)
        {
            Explanation exp; // LUCENENET: IDE0059: Remove unnecessary value assignment

            doc = doc + @base;
            try
            {
                exp = s.Explain(q, doc);
            }
            catch (Exception e) when(e.IsIOException())
            {
                throw RuntimeException.Create("exception in hitcollector of [[" + d + "]] for #" + doc, e);
            }

            Assert.IsNotNull(exp, "Explanation of [[" + d + "]] for #" + doc + " is null");
            CheckHits.VerifyExplanation(d, doc, scorer.GetScore(), deep, exp);
            Assert.IsTrue(exp.IsMatch, "Explanation of [[" + d + "]] for #" + doc + " does not indicate match: " + exp.ToString());
        }