/// <summary>Implemented as /// <code>state.getBoost()*lengthNorm(numTerms)</code>, where /// <code>numTerms</code> is {@link FieldInvertState#GetLength()} if {@link /// #setDiscountOverlaps} is false, else it's {@link /// FieldInvertState#GetLength()} - {@link /// FieldInvertState#GetNumOverlap()}. /// /// <p/><b>WARNING</b>: This API is new and experimental, and may suddenly /// change.<p/> /// </summary> public override float ComputeNorm(System.String field, FieldInvertState state) { int numTerms; if (discountOverlaps) numTerms = state.GetLength() - state.GetNumOverlap(); else numTerms = state.GetLength(); return (float) (state.GetBoost() * LengthNorm(field, numTerms)); }
/// <summary>Implemented as /// <code>state.getBoost()*lengthNorm(numTerms)</code>, where /// <code>numTerms</code> is {@link FieldInvertState#GetLength()} if {@link /// #setDiscountOverlaps} is false, else it's {@link /// FieldInvertState#GetLength()} - {@link /// FieldInvertState#GetNumOverlap()}. /// /// <p/><b>WARNING</b>: This API is new and experimental, and may suddenly /// change.<p/> /// </summary> public override float ComputeNorm(System.String field, FieldInvertState state) { int numTerms; if (discountOverlaps) { numTerms = state.GetLength() - state.GetNumOverlap(); } else { numTerms = state.GetLength(); } return((float)(state.GetBoost() * LengthNorm(field, numTerms))); }
/// <summary> Compute the normalization value for a field, given the accumulated /// state of term processing for this field (see {@link FieldInvertState}). /// /// <p/>Implementations should calculate a float value based on the field /// state and then return that value. /// /// <p/>For backward compatibility this method by default calls /// {@link #LengthNorm(String, int)} passing /// {@link FieldInvertState#GetLength()} as the second argument, and /// then multiplies this value by {@link FieldInvertState#GetBoost()}.<p/> /// /// <p/><b>WARNING</b>: This API is new and experimental and may /// suddenly change.<p/> /// /// </summary> /// <param name="field">field name /// </param> /// <param name="state">current processing state for this field /// </param> /// <returns> the calculated float norm /// </returns> public virtual float ComputeNorm(System.String field, FieldInvertState state) { return (float) (state.GetBoost() * LengthNorm(field, state.GetLength())); }
/// <summary> Compute the normalization value for a field, given the accumulated /// state of term processing for this field (see <seealso cref="FieldInvertState"/>). /// /// <p/>Implementations should calculate a float value based on the field /// state and then return that value. /// /// <p/>For backward compatibility this method by default calls /// {@link #LengthNorm(String, int)} passing /// {@link FieldInvertState#GetLength()} as the second argument, and /// then multiplies this value by <seealso cref="FieldInvertState.GetBoost()"/>.<p/> /// /// <p/><b>WARNING</b>: This API is new and experimental and may /// suddenly change.<p/> /// /// </summary> /// <param name="field">field name /// </param> /// <param name="state">current processing state for this field /// </param> /// <returns> the calculated float norm /// </returns> public virtual float ComputeNorm(System.String field, FieldInvertState state) { return((float)(state.GetBoost() * LengthNorm(field, state.GetLength()))); }