BoostAttribute (Lucene 10.5.1 core API)
Description: declaration: package: org.apache.lucene.search, interface: BoostAttribute

Package org.apache.lucene.search

# Interface BoostAttribute

All Superinterfaces:
  `Attribute`

All Known Implementing Classes:
  `BoostAttributeImpl`

public interface BoostAttribute extends Attribute
Add this `Attribute` to a `TermsEnum` returned by `MultiTermQuery.getTermsEnum(Terms,AttributeSource)` and update the boost on each returned term. This enables to control the boost factor for each matching term in `MultiTermQuery.SCORING_BOOLEAN_REWRITE` or `TopTermsRewrite` mode. `FuzzyQuery` is using this to take the edit distance into account.

Please note: This attribute is intended to be added only by the TermsEnum to itself in its constructor and consumed by the `MultiTermQuery.RewriteMethod`.

NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final float`
  `DEFAULT_BOOST`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `float`
  `getBoost()`
  Retrieves the boost, default is `1.0f`.
  `void`
  `setBoost(float boost)`
  Sets the boost in this attribute

- ## Field Details

  - ### DEFAULT_BOOST

    static final float DEFAULT_BOOST
    See Also:
      - Constant Field Values

- ## Method Details

  - ### setBoost

    void setBoost(float boost)
    Sets the boost in this attribute

  - ### getBoost

    float getBoost()
    Retrieves the boost, default is `1.0f`.