Example #1
0
 public override void  Normalize(float norm)
 {
     norm *= Enclosing_Instance.GetBoost();                 // incorporate boost
     for (System.Collections.IEnumerator iter = weights.GetEnumerator(); iter.MoveNext();)
     {
         Weight w = (Weight)iter.Current;
         // normalize all clauses, (even if prohibited in case of side affects)
         w.Normalize(norm);
     }
 }
Example #2
0
        /// <summary> Expert: Constructs and initializes a Weight for a top-level query.</summary>
        public virtual Weight Weight(Searcher searcher)
        {
            Query  query  = searcher.Rewrite(this);
            Weight weight = query.CreateWeight(searcher);
            float  sum    = weight.SumOfSquaredWeights();
            float  norm   = GetSimilarity(searcher).QueryNorm(sum);

            if (float.IsInfinity(norm) || float.IsNaN(norm))
            {
                norm = 1.0f;
            }
            weight.Normalize(norm);
            return(weight);
        }