Class NGramAnalyzerProperties


  • public final class NGramAnalyzerProperties
    extends Object
    An Analyzer capable of producing n-grams from a specified input in a range of min..max (inclusive). Can optionally preserve the original input.

    This Analyzer type can be used to implement substring matching. Note that it slices the input based on bytes and not characters by default (streamType). The “binary” mode supports single-byte characters only; multi-byte UTF-8 characters raise an Invalid UTF-8 sequence query error.

    Author:
    Michele Rastelli
    See Also:
    API Documentation
    • Constructor Detail

      • NGramAnalyzerProperties

        public NGramAnalyzerProperties()
    • Method Detail

      • getMin

        public long getMin()
        Returns:
        minimum n-gram length
      • setMin

        public void setMin​(long min)
      • getMax

        public long getMax()
        Returns:
        maximum n-gram length
      • setMax

        public void setMax​(long max)
      • isPreserveOriginal

        public boolean isPreserveOriginal()
        Returns:
        true to include the original value as well false to produce the n-grams based on min and max only
      • setPreserveOriginal

        public void setPreserveOriginal​(boolean preserveOriginal)
      • getStartMarker

        public String getStartMarker()
        Returns:
        this value will be prepended to n-grams which include the beginning of the input. Can be used for matching prefixes. Choose a character or sequence as marker which does not occur in the input
      • setStartMarker

        public void setStartMarker​(String startMarker)
      • getEndMarker

        public String getEndMarker()
        Returns:
        this value will be appended to n-grams which include the end of the input. Can be used for matching suffixes. Choose a character or sequence as marker which does not occur in the input.
      • setEndMarker

        public void setEndMarker​(String endMarker)
      • getStreamType

        public StreamType getStreamType()
      • setStreamType

        public void setStreamType​(StreamType streamType)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object