Class FuzzyScheme

java.lang.Object
org.aesh.readline.fuzzy.FuzzyScheme

public final class FuzzyScheme extends Object
Scoring constants for fuzzy matching.

Three preset schemes are provided matching fzf's --scheme option:

  • DEFAULT — General-purpose scoring
  • PATH — Optimized for file paths (delimiter bonus for path separators)
  • HISTORY — Optimized for command history (equalized boundary bonuses)

The scoring parameters are tuned so that the boundary bonus is cancelled when the gap between matching characters grows beyond ~8 characters (approximately the average word length).

See Also:
  • Field Details

    • SCORE_MATCH

      public static final short SCORE_MATCH
      Score awarded for each matching character.
      See Also:
    • SCORE_GAP_START

      public static final short SCORE_GAP_START
      Penalty for starting a gap (non-matching characters between matches).
      See Also:
    • SCORE_GAP_EXTENSION

      public static final short SCORE_GAP_EXTENSION
      Penalty for extending a gap (each additional non-matching character).
      See Also:
    • BONUS_BOUNDARY

      public static final short BONUS_BOUNDARY
      Bonus for matching at a word boundary (after non-word/delimiter character). Set so that the bonus is cancelled when the gap exceeds ~8 characters.
      See Also:
    • BONUS_NON_WORD

      public static final short BONUS_NON_WORD
      Bonus for matching a non-word character.
      See Also:
    • BONUS_CAMEL_123

      public static final short BONUS_CAMEL_123
      Bonus for camelCase transitions (lower->UPPER) and number boundaries. Slightly less than boundary bonus since camelCase doesn't have single-char gaps.
      See Also:
    • BONUS_CONSECUTIVE

      public static final short BONUS_CONSECUTIVE
      Minimum bonus for consecutive matching characters. Ensures consecutive chunks are ranked higher than gapped matches.
      See Also:
    • BONUS_FIRST_CHAR_MULTIPLIER

      public static final short BONUS_FIRST_CHAR_MULTIPLIER
      Multiplier for the first character's bonus. The first typed character is more significant — users typically start with the most important character.
      See Also:
    • bonusBoundaryWhite

      public final short bonusBoundaryWhite
      Bonus for word boundary after whitespace (scheme-dependent).
    • bonusBoundaryDelimiter

      public final short bonusBoundaryDelimiter
      Bonus for word boundary after a delimiter (scheme-dependent).
    • initialCharClass

      public final int initialCharClass
      The character class assumed before the first character. WHITE for default/history (beginning of input acts like a word boundary), DELIMITER for path scheme (beginning acts like after a path separator).
    • DEFAULT

      public static final FuzzyScheme DEFAULT
      Default scheme — general-purpose fuzzy matching. Whitespace boundaries get a small extra bonus over delimiter boundaries.
    • PATH

      public static final FuzzyScheme PATH
      Path scheme — optimized for file path matching. Whitespace and delimiter boundaries are equalized. Path separators get a slight edge. Beginning of input is treated as after a delimiter.
    • HISTORY

      public static final FuzzyScheme HISTORY
      History scheme — optimized for command history search. All boundary types get equal bonus since whitespace and delimiters are equally important in command strings.