Class TokenPruningConfig

java.lang.Object
org.elasticsearch.index.mapper.vectors.TokenPruningConfig
All Implemented Interfaces:
Writeable, ToXContent, ToXContentObject

public class TokenPruningConfig extends Object implements Writeable, ToXContentObject
  • Field Details

    • PRUNING_CONFIG_FIELD

      public static final String PRUNING_CONFIG_FIELD
      See Also:
    • TOKENS_FREQ_RATIO_THRESHOLD

      public static final ParseField TOKENS_FREQ_RATIO_THRESHOLD
    • TOKENS_WEIGHT_THRESHOLD

      public static final ParseField TOKENS_WEIGHT_THRESHOLD
    • ONLY_SCORE_PRUNED_TOKENS_FIELD

      public static final ParseField ONLY_SCORE_PRUNED_TOKENS_FIELD
    • DEFAULT_TOKENS_FREQ_RATIO_THRESHOLD

      public static final float DEFAULT_TOKENS_FREQ_RATIO_THRESHOLD
      See Also:
    • MAX_TOKENS_FREQ_RATIO_THRESHOLD

      public static final float MAX_TOKENS_FREQ_RATIO_THRESHOLD
      See Also:
    • DEFAULT_TOKENS_WEIGHT_THRESHOLD

      public static final float DEFAULT_TOKENS_WEIGHT_THRESHOLD
      See Also:
    • PARSER

      public static final ConstructingObjectParser<TokenPruningConfig,Void> PARSER
  • Constructor Details

    • TokenPruningConfig

      public TokenPruningConfig()
    • TokenPruningConfig

      public TokenPruningConfig(float tokensFreqRatioThreshold, float tokensWeightThreshold, boolean onlyScorePrunedTokens)
    • TokenPruningConfig

      public TokenPruningConfig(StreamInput in) throws IOException
      Throws:
      IOException
  • Method Details

    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • getTokensFreqRatioThreshold

      public float getTokensFreqRatioThreshold()
      Returns the frequency ratio threshold to apply on the query. Tokens whose frequency is more than ratio_threshold times the average frequency of all tokens in the specified field are considered outliers and may be subject to removal from the query.
    • getTokensWeightThreshold

      public float getTokensWeightThreshold()
      Returns the weight threshold to apply on the query. Tokens whose weight is more than (weightThreshold * best_weight) of the highest weight in the query are not considered outliers, even if their frequency exceeds the specified ratio_threshold. This threshold ensures that important tokens, as indicated by their weight, are retained in the query.
    • isOnlyScorePrunedTokens

      public boolean isOnlyScorePrunedTokens()
      Returns whether the filtering process retains tokens identified as non-relevant based on the specified thresholds (ratio and weight). When true, only non-relevant tokens are considered for matching and scoring documents. Enabling this option is valuable for re-scoring top hits retrieved from another QueryBuilder with active thresholds.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toXContent

      public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface ToXContent
      Throws:
      IOException
    • fromXContent

      public static TokenPruningConfig fromXContent(XContentParser parser) throws IOException
      Throws:
      IOException
    • parseFromMap

      public static TokenPruningConfig parseFromMap(Map<String,Object> pruningConfigMap)