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); } }
/// <summary> /// Creates a normalized weight for a top-level <see cref="Query"/>. /// The query is rewritten by this method and <see cref="Query.CreateWeight(IndexSearcher)"/> called, /// afterwards the <see cref="Weight"/> is normalized. The returned <see cref="Weight"/> /// can then directly be used to get a <see cref="Scorer"/>. /// <para/> /// @lucene.internal /// </summary> public virtual Weight CreateNormalizedWeight(Query query) { query = Rewrite(query); Weight weight = query.CreateWeight(this); float v = weight.GetValueForNormalization(); float norm = Similarity.QueryNorm(v); if (float.IsInfinity(norm) || float.IsNaN(norm)) { norm = 1.0f; } weight.Normalize(norm, 1.0f); return(weight); }
public override void Normalize(float norm, float topLevelBoost) { weight.Normalize(norm, topLevelBoost * outerInstance.Boost); // incorporate boost }