Пример #1
0
        public override Explanation Explain(int doc)
        {
            TermQuery   query         = (TermQuery)weight.Query;
            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);
        }