/// <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 /// <c>state.getBoost()*lengthNorm(numTerms)</c>, where /// <c>numTerms</c> is <see cref="FieldInvertState.Length" /> if <see cref="DiscountOverlaps" /> /// is false, else it's <see cref="FieldInvertState.Length" /> /// - <see cref="FieldInvertState.NumOverlap" /> ///. /// /// <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 (internalDiscountOverlaps) numTerms = state.Length - state.NumOverlap; else numTerms = state.Length; return (state.Boost * 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>Implemented as /// <c>state.getBoost()*lengthNorm(numTerms)</c>, where /// <c>numTerms</c> is <see cref="FieldInvertState.Length" /> if <see cref="DiscountOverlaps" /> /// is false, else it's <see cref="FieldInvertState.Length" /> /// - <see cref="FieldInvertState.NumOverlap" /> ///. /// /// <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 (internalDiscountOverlaps) { numTerms = state.Length - state.NumOverlap; } else { numTerms = state.Length; } return(state.Boost * LengthNorm(field, numTerms)); }
public override float ComputeNorm(System.String field, Lucene.Net.Index.FieldInvertState state) { int numTerms; if (discountOverlaps) { numTerms = state.Length - state.NumOverlap; } else { numTerms = state.Length; } return((float)(state.Boost * LengthNorm(field, numTerms))); }
/// <summary> /// Encodes the document length in the same way as <seealso cref="TFIDFSimilarity"/>. </summary> public override long ComputeNorm(FieldInvertState state) { float numTerms; if (DiscountOverlaps_Renamed) { numTerms = state.Length - state.NumOverlap; } else { numTerms = state.Length; } return(EncodeNormValue(state.Boost, numTerms)); }
/// <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()))); }
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //Make everything else 1 so we see the effect of the payload //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! public override float LengthNorm(FieldInvertState state) { return state.Boost; }
/// <summary> /// Computes the normalization value for a field, given the accumulated /// state of term processing for this field (see <seealso cref="FieldInvertState"/>). /// /// <p>Matches in longer fields are less precise, so implementations of this /// method usually set smaller values when <code>state.getLength()</code> is large, /// and larger values when <code>state.getLength()</code> is small. /// /// @lucene.experimental /// </summary> /// <param name="state"> current processing state for this field </param> /// <returns> computed norm value </returns> public abstract long ComputeNorm(FieldInvertState state);
public override long ComputeNorm(FieldInvertState state) { return Sims[0].ComputeNorm(state); }
/// <summary> /// Encodes the document length in the same way as <seealso cref="TFIDFSimilarity"/>. </summary> public override long ComputeNorm(FieldInvertState state) { float numTerms; if (DiscountOverlaps_Renamed) { numTerms = state.Length - state.NumOverlap; } else { numTerms = state.Length; } return EncodeNormValue(state.Boost, numTerms); }
public override float ComputeNorm(System.String fieldName, FieldInvertState state) { return(delegee.ComputeNorm(fieldName, state)); }
public override long ComputeNorm(FieldInvertState state) { return 1; // we dont care }
/// <summary> /// Compute an index-time normalization value for this field instance. /// <p> /// this value will be stored in a single byte lossy representation by /// <seealso cref="#encodeNormValue(float)"/>. /// </summary> /// <param name="state"> statistics of the current field (such as length, boost, etc) </param> /// <returns> an index-time normalization value </returns> public abstract float LengthNorm(FieldInvertState state);
public override sealed long ComputeNorm(FieldInvertState state) { float normValue = LengthNorm(state); return EncodeNormValue(normValue); }
public override float LengthNorm(FieldInvertState state) { return 10f; }
/// <summary> Compute the normalization value for a field, given the accumulated /// state of term processing for this field (see <see 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 /// <see cref="LengthNorm(string, int)" /> passing /// <see cref="FieldInvertState.GetLength()" /> as the second argument, and /// then multiplies this value by <see 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(string field, FieldInvertState state) { return((float)(state.Boost * LengthNorm(field, state.Length))); }
public override sealed long ComputeNorm(FieldInvertState state) { return(Get(state.Name).ComputeNorm(state)); }
public virtual void TestDiscountOverlapsBoost() { DefaultSimilarity expected = new DefaultSimilarity(); SimilarityBase actual = new DFRSimilarity(new BasicModelIne(), new AfterEffectB(), new NormalizationH2()); expected.DiscountOverlaps = false; actual.DiscountOverlaps = false; FieldInvertState state = new FieldInvertState("foo"); state.Length = 5; state.NumOverlap = 2; state.Boost = 3; Assert.AreEqual(expected.ComputeNorm(state), actual.ComputeNorm(state)); expected.DiscountOverlaps = true; actual.DiscountOverlaps = true; Assert.AreEqual(expected.ComputeNorm(state), actual.ComputeNorm(state)); }
public override float ComputeNorm(System.String fieldName, FieldInvertState state) { return delegee.ComputeNorm(fieldName, state); }
public override sealed long ComputeNorm(FieldInvertState state) { return Get(state.Name).ComputeNorm(state); }
/// <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())); }
public override long ComputeNorm(FieldInvertState state) { return(Sims[0].ComputeNorm(state)); }