Class CommonGramTokenFilter


  • public final class CommonGramTokenFilter
    extends TokenFilter
    Construct bigrams for frequently occurring terms while indexing. Single terms are still indexed too, with bigrams overlaid. This token filter is implemented using Apache Lucene.
    • Constructor Detail

      • CommonGramTokenFilter

        public CommonGramTokenFilter​(String name,
                                     List<String> commonWords)
        Constructor of TokenFilter.
        Parameters:
        name - The name of the token filter. It must only contain letters, digits, spaces, dashes or underscores, can only start and end with alphanumeric characters, and is limited to 128 characters.
        commonWords - The set of common words.
    • Method Detail

      • getCommonWords

        public List<String> getCommonWords()
        Get the commonWords property: The set of common words.
        Returns:
        the commonWords value.
      • isCaseIgnored

        public Boolean isCaseIgnored()
        Get the ignoreCase property: A value indicating whether common words matching will be case insensitive. Default is false.
        Returns:
        the ignoreCase value.
      • setCaseIgnored

        public CommonGramTokenFilter setCaseIgnored​(Boolean caseIgnored)
        Set the ignoreCase property: A value indicating whether common words matching will be case insensitive. Default is false.
        Parameters:
        caseIgnored - the ignoreCase value to set.
        Returns:
        the CommonGramTokenFilter object itself.
      • isQueryModeUsed

        public Boolean isQueryModeUsed()
        Get the useQueryMode property: A value that indicates whether the token filter is in query mode. When in query mode, the token filter generates bigrams and then removes common words and single terms followed by a common word. Default is false.
        Returns:
        the useQueryMode value.
      • setQueryModeUsed

        public CommonGramTokenFilter setQueryModeUsed​(Boolean queryModeUsed)
        Set the useQueryMode property: A value that indicates whether the token filter is in query mode. When in query mode, the token filter generates bigrams and then removes common words and single terms followed by a common word. Default is false.
        Parameters:
        queryModeUsed - the useQueryMode value to set.
        Returns:
        the CommonGramTokenFilter object itself.