org.apache.lucene.search.similarities

## Class Similarity.SimWeight

- java.lang.Object
- - org.apache.lucene.search.similarities.Similarity.SimWeight

- Direct Known Subclasses:
    BasicStats
  Enclosing class:
    Similarity

      public abstract static class Similarity.SimWeight
      extends Object

  Stores the weight for a query across the indexed collection. This abstract implementation is empty; descendants of `Similarity` should subclass `SimWeight` and define the statistics they require in the subclass. Examples include idf, average field length, etc.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SimWeight()` Sole constructor.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract float` | `getValueForNormalization()` The value for normalization of contained query clauses (e.g.
    `abstract void` | `normalize(float queryNorm, float boost)` Assigns the query normalization factor and boost from parent queries to this.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SimWeight

          public SimWeight()

      Sole constructor. (For invocation by subclass constructors, typically implicit.)

  - ### Method Detail

    - #### getValueForNormalization

          public abstract float getValueForNormalization()

      The value for normalization of contained query clauses (e.g. sum of squared weights).

      NOTE: a Similarity implementation might not use any query normalization at all, it's not required. However, if it wants to participate in query normalization, it can return a value here.

    - #### normalize

          public abstract void normalize(float queryNorm,
                                         float boost)

      Assigns the query normalization factor and boost from parent queries to this.

      NOTE: a Similarity implementation might not use this normalized value at all, it's not required. However, it's usually a good idea to at least incorporate the boost into its score.

      NOTE: If this method is called several times, it behaves as if only the last call was performed.

Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.