Class TypeAheadKeywordPostProcessor.KeywordContainer

  • Enclosing class:
    TypeAheadKeywordPostProcessor

    protected static class TypeAheadKeywordPostProcessor.KeywordContainer
    extends Object
    Class holding potential suggestions. Used to differentiate potential multi-term suggestions by terms that occur before and after the highlighted terms, as priority is given to terms that occur after the highlighted string.

    Preserves case of strings added and does not allow duplicates (ignores case).

    • Constructor Detail

      • KeywordContainer

        public KeywordContainer()
    • Method Detail

      • addKeyword

        public void addKeyword​(String rawTerm,
                               String highlightTerm)
      • addSecondary

        public void addSecondary​(String rawTerm,
                                 String highlightTerm)
      • size

        public int size()
      • getAllKeywords

        public List<String> getAllKeywords()
        Returns:
        All keywords with higher priority terms occurring earlier in the list.
      • shouldAdd

        protected boolean shouldAdd​(String term)
        Checks if:
        • 1. The exact term already exists
          2. A plural form (ends with s) has already been added
      • If either condition is met, this returns false.
Parameters:
term - The term to check
Returns:
true if should be added, else false.