PositionLengthAttribute (Lucene 10.5.1 core API)
Description: declaration: package: org.apache.lucene.analysis.tokenattributes, interface: PositionLengthAttribute

Package org.apache.lucene.analysis.tokenattributes

# Interface PositionLengthAttribute

All Superinterfaces:
  `Attribute`

All Known Implementing Classes:
  `PackedTokenAttributeImpl`, `PositionLengthAttributeImpl`

public interface PositionLengthAttribute extends Attribute
Determines how many positions this token spans. Very few analyzer components actually produce this attribute, and indexing ignores it, but it's useful to express the graph structure naturally produced by decompounding, word splitting/joining, synonym filtering, etc.

NOTE: this is optional, and most analyzers don't change the default value (1).

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `getPositionLength()`
  Returns the position length of this Token.
  `void`
  `setPositionLength(int positionLength)`
  Set the position length of this Token.

- ## Method Details

  - ### setPositionLength

    void setPositionLength(int positionLength)
    Set the position length of this Token.

    The default value is one.

    Parameters:
      `positionLength` - how many positions this token spans.
    Throws:
      `IllegalArgumentException` - if `positionLength` is zero or negative.
    See Also:
      - `getPositionLength()`

  - ### getPositionLength

    int getPositionLength()
    Returns the position length of this Token.
    See Also:
      - `setPositionLength(int)`