AnalyzerWrapper

abstract class AnalyzerWrapper : Analyzer

Extension to Analyzer suitable for Analyzers which wrap other Analyzers.

getWrappedAnalyzer allows the Analyzer to wrap multiple Analyzers which are selected on a per field basis.

wrapComponents allows the TokenStreamComponents of the wrapped Analyzer to then be wrapped (such as adding a new TokenFilter to form new TokenStreamComponents.

wrapReader allows the Reader of the wrapped Analyzer to then be wrapped (such as adding a new CharFilter.

Important: If you do not want to wrap the TokenStream using wrapComponents or the Reader using wrapReader and just delegate to other analyzers (like by field name), use DelegatingAnalyzerWrapper as superclass.

Since

4.0.0

Inheritors

Types

Link copied to clipboard

A org.gnit.lucenekmp.analysis.Analyzer.ReuseStrategy that checks the wrapped analyzer's strategy for reusability. If the wrapped analyzer's strategy returns null, components need to be re-created.

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open override fun close()

Frees persistent resources used by this Analyzer

Link copied to clipboard
open override fun getOffsetGap(fieldName: String?): Int

Just like .getPositionIncrementGap, 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.

Link copied to clipboard
open override fun getPositionIncrementGap(fieldName: String?): Int

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

Link copied to clipboard
fun normalize(fieldName: String, text: String): BytesRef

Normalize a string down to the representation that it would have in the index.

Link copied to clipboard
fun tokenStream(fieldName: String, text: String): TokenStream

Returns a TokenStream suitable for fieldName, tokenizing the contents of text.

fun tokenStream(fieldName: String, reader: Reader): TokenStream

Returns a TokenStream suitable for fieldName, tokenizing the contents of reader.