Lucene.Net.Search.Searcher.DocFreq C# (CSharp) Method

DocFreq() public abstract method

public abstract DocFreq ( Lucene.Net.Index.Term term ) : int
term Lucene.Net.Index.Term
return int
		public abstract int DocFreq(Term term);
	    public abstract int MaxDoc { get; }

Usage Example

コード例 #1
0
        /// <summary> Computes a score factor for a phrase.
        ///
        /// <p/>
        /// The default implementation sums the idf factor for
        /// each term in the phrase.
        ///
        /// </summary>
        /// <param name="terms">the terms in the phrase
        /// </param>
        /// <param name="searcher">the document collection being searched
        /// </param>
        /// <returns> an IDFExplain object that includes both an idf
        /// score factor for the phrase and an explanation
        /// for each term.
        /// </returns>
        /// <throws>  IOException </throws>
        public virtual IDFExplanation idfExplain(IList <Lucene.Net.Index.Term> terms, Searcher searcher)
        {
            if (SupportedMethods.overridesCollectionIDF)
            {
                float idf = Idf(terms, searcher);
                return(new IDFExplanation
                {
                    GetIdf = () => idf,
                    Explain = () => "Inexplicable"
                });
            }
            int   max  = searcher.MaxDoc();
            float idf2 = 0.0f;

            System.Text.StringBuilder exp = new System.Text.StringBuilder();
            foreach (Term term in terms)
            {
                int df = searcher.DocFreq(term);
                idf2 += Idf(df, max);
                exp.Append(" ");
                exp.Append(term.Text());
                exp.Append("=");
                exp.Append(df);
            }
            float fIdf = idf2;

            return(new IDFExplanation
            {
                GetIdf = () => fIdf,
                Explain = () => exp.ToString()
            });
        }
All Usage Examples Of Lucene.Net.Search.Searcher::DocFreq