Lucene.Net.Search.Similarity.QueryNorm C# (CSharp) Method

QueryNorm() public abstract method

Computes the normalization value for a query given the sum of the squared weights of each of the query terms. This value is then multipled into the weight of each query term.

This does not affect ranking, but rather just attempts to make scores from different queries comparable.

public abstract QueryNorm ( float sumOfSquaredWeights ) : float
sumOfSquaredWeights float the sum of the squares of query term weights ///
return float
		public abstract float QueryNorm(float sumOfSquaredWeights);
		

Usage Example

コード例 #1
0
ファイル: IndexSearcher.cs プロジェクト: freemsly/lucenenet
        /// <summary>
        /// Creates a normalized weight for a top-level <seealso cref="Query"/>.
        /// The query is rewritten by this method and <seealso cref="Query#createWeight"/> called,
        /// afterwards the <seealso cref="Weight"/> is normalized. The returned {@code Weight}
        /// can then directly be used to get a <seealso cref="Scorer"/>.
        /// @lucene.internal
        /// </summary>
        public virtual Weight CreateNormalizedWeight(Query query)
        {
            query = Rewrite(query);
            Weight weight = query.CreateWeight(this);
            float  v      = weight.ValueForNormalization;
            float  norm   = Similarity.QueryNorm(v);

            if (float.IsInfinity(norm) || float.IsNaN(norm))
            {
                norm = 1.0f;
            }
            weight.Normalize(norm, 1.0f);
            return(weight);
        }
All Usage Examples Of Lucene.Net.Search.Similarity::QueryNorm