/// <summary>Returns an explanation of the score for a document. /// <br>When this method is used, the {@link #Next()} method /// and the {@link #Score(HitCollector)} method should not be used. /// </summary> /// <param name="doc">The document number for the explanation. /// </param> /// <todo> Modify to make use of {@link TermDocs#SkipTo(int)}. </todo> public override Explanation Explain(int doc) { TermQuery query = (TermQuery)weight.GetQuery(); Explanation tfExplanation = new Explanation(); int tf = 0; while (pointer < pointerMax) { if (docs[pointer] == doc) { tf = freqs[pointer]; } pointer++; } if (tf == 0) { while (termDocs.Next()) { if (termDocs.Doc() == doc) { tf = termDocs.Freq(); } } } termDocs.Close(); tfExplanation.SetValue(GetSimilarity().Tf(tf)); tfExplanation.SetDescription("tf(termFreq(" + query.GetTerm() + ")=" + tf + ")"); return(tfExplanation); }