Class Analyzer

    • Method Detail

      • getPositionIncrementGap

        public int getPositionIncrementGap​(String fieldName)
        Invoked before indexing a IndexableField instance if terms have already been added to that field. This allows custom analyzers to place an automatic position increment gap between IndexbleField instances using the same field name. The default value position increment gap is 0. With a 0 position increment gap and the typical default token position increment of 1, all terms in a field, including across IndexableField instances, are in successive positions, allowing exact PhraseQuery matches, for instance, across IndexableField instance boundaries.
        Parameters:
        fieldName - IndexableField name being indexed.
        Returns:
        position increment gap, added to the next token emitted from tokenStream(String,Reader). This value must be >= 0.
      • getOffsetGap

        public int getOffsetGap​(String fieldName)
        Just like getPositionIncrementGap(java.lang.String), except for Token offsets instead. By default this returns 1. This method is only called if the field produced at least one token for indexing.
        Parameters:
        fieldName - the field just indexed
        Returns:
        offset gap, added to the next token emitted from tokenStream(String,Reader). This value must be >= 0.
      • close

        public void close()
        Frees persistent resources used by this Analyzer
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable