Normalize() public abstract method

Assigns the query normalization factor to this.
public abstract Normalize ( float norm ) : void
norm float
return void
Ejemplo n.º 1
0
 public override void Normalize(float norm, float topLevelBoost)
 {
     this.queryNorm = norm * topLevelBoost;
     queryWeight   *= this.queryNorm;
     // we normalize the inner weight, but ignore it (just to initialize everything)
     if (innerWeight != null)
     {
         innerWeight.Normalize(norm, topLevelBoost);
     }
 }
Ejemplo n.º 2
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);
     }
 }
Ejemplo n.º 3
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);

            weight.Normalize(norm);
            return(weight);
        }
Ejemplo n.º 4
0
 public virtual void  Normalize(float norm)
 {
     norm *= Enclosing_Instance.GetBoost();                 // incorporate boost
     for (int i = 0; i < weights.Count; i++)
     {
         Weight w = (Weight)weights[i];
         // normalize all clauses, (even if prohibited in case of side affects)
         w.Normalize(norm);
     }
 }
Ejemplo n.º 5
0
 public virtual void  Normalize(float norm)
 {
     norm *= Enclosing_Instance.GetBoost();                 // incorporate boost
     for (int i = 0; i < weights.Count; i++)
     {
         BooleanClause c = (BooleanClause)Enclosing_Instance.clauses[i];
         Weight        w = (Weight)weights[i];
         if (!c.IsProhibited())
         {
             w.Normalize(norm);
         }
     }
 }
Ejemplo n.º 6
0
        /// <summary> Expert: Constructs and initializes a Weight for a top-level query.</summary>
        public virtual Weight Weight(Searcher searcher, IState state)
        {
            Query  query  = searcher.Rewrite(this, state);
            Weight weight = query.CreateWeight(searcher, state);
            float  sum    = weight.GetSumOfSquaredWeights();
            float  norm   = GetSimilarity(searcher).QueryNorm(sum);

            if (float.IsInfinity(norm) || float.IsNaN(norm))
            {
                norm = 1.0f;
            }
            weight.Normalize(norm);
            return(weight);
        }
Ejemplo n.º 7
0
        /// <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);
        }
Ejemplo n.º 8
0
 public override void Normalize(float norm, float topLevelBoost)
 {
     weight.Normalize(norm, topLevelBoost * outerInstance.Boost); // incorporate boost
 }
Ejemplo n.º 9
0
 public override void Normalize(float norm, float topLevelBoost)
 {
     @in.Normalize(norm, topLevelBoost);
 }