org.apache.lucene.analysis

Class DelegatingAnalyzerWrapper

  • All Implemented Interfaces:
    Closeable, AutoCloseable
    Direct Known Subclasses:
    PerFieldAnalyzerWrapper


    public abstract class DelegatingAnalyzerWrapper
    extends AnalyzerWrapper
    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 Analyzer.getReuseStrategy(). 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.