DelegatingAnalyzerWrapper

An analyzer wrapper, that doesn't allow to wrap components or readers. By disallowing it, it means that the thread local resources can be delegated to the delegate analyzer, and not also be allocated on this analyzer. This wrapper class is the base class of all analyzers that just delegate to another analyzer, e.g. per field name.

This solves the problem of per field analyzer wrapper, where it also maintains a thread local per field token stream components, while it can safely delegate those and not also hold these data structures, which can become expensive memory wise.

Please note: This analyzer uses a private Analyzer.ReuseStrategy, which is returned by . This strategy is used when delegating. If you wrap this analyzer again and reuse this strategy, no delegation is done and the given fallback is used.

Since

4.10.0

Types

Link copied to clipboard

A org.gnit.lucenekmp.analysis.Analyzer.ReuseStrategy that delegates to the wrapped analyzer's strategy for reusability of components.

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.