Class BaseManagedTokenFilterFactory

  • All Implemented Interfaces:
    org.apache.lucene.util.ResourceLoaderAware, ManagedResourceObserver
    Direct Known Subclasses:
    ManagedStopFilterFactory, ManagedSynonymFilterFactory, ManagedSynonymGraphFilterFactory

    public abstract class BaseManagedTokenFilterFactory
    extends org.apache.lucene.analysis.TokenFilterFactory
    implements org.apache.lucene.util.ResourceLoaderAware, ManagedResourceObserver
    Abstract based class for implementing TokenFilterFactory objects that are managed by the REST API. Specifically, this base class is useful for token filters that have configuration and data that needs to be updated programmatically, such as to support a UI for adding synonyms.
    Since:
    4.8.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected String handle  
      • Fields inherited from class org.apache.lucene.analysis.AbstractAnalysisFactory

        LUCENE_MATCH_VERSION_PARAM, luceneMatchVersion
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract Class<? extends ManagedResource> getManagedResourceImplClass()
      Let the concrete analysis component determine the ManagedResource implementation.
      protected abstract String getResourceId()
      Let the concrete analysis component decide the path it wishes to be managed at.
      void inform​(org.apache.lucene.util.ResourceLoader loader)
      Registers an endpoint with the RestManager so that this component can be managed using the REST API.
      • Methods inherited from class org.apache.lucene.analysis.TokenFilterFactory

        availableTokenFilters, create, findSPIName, forName, lookupClass, normalize, reloadTokenFilters
      • Methods inherited from class org.apache.lucene.analysis.AbstractAnalysisFactory

        defaultCtorException, get, get, get, get, get, getBoolean, getChar, getClassArg, getFloat, getInt, getLines, getLuceneMatchVersion, getOriginalArgs, getPattern, getSet, getSnowballWordSet, getWordSet, isExplicitLuceneMatchVersion, require, require, require, requireBoolean, requireChar, requireFloat, requireInt, setExplicitLuceneMatchVersion, splitAt, splitFileNames
    • Field Detail

      • handle

        protected String handle
    • Constructor Detail

      • BaseManagedTokenFilterFactory

        protected BaseManagedTokenFilterFactory​(Map<String,​String> args)
      • BaseManagedTokenFilterFactory

        public BaseManagedTokenFilterFactory()
        Default ctor for compatibility with SPI
    • Method Detail

      • inform

        public void inform​(org.apache.lucene.util.ResourceLoader loader)
                    throws IOException
        Registers an endpoint with the RestManager so that this component can be managed using the REST API. This method can be invoked before all the resources the RestManager needs to initialize a ManagedResource are available, so this simply registers the need to be managed at a specific endpoint and lets the RestManager deal with initialization when ready.
        Specified by:
        inform in interface org.apache.lucene.util.ResourceLoaderAware
        Throws:
        IOException
      • getResourceId

        protected abstract String getResourceId()
        Let the concrete analysis component decide the path it wishes to be managed at.
      • getManagedResourceImplClass

        protected abstract Class<? extends ManagedResource> getManagedResourceImplClass()
        Let the concrete analysis component determine the ManagedResource implementation. As there can be many instances of the same analysis component in a schema, this class should not presume to create ManagedResource. For instance, there may be 10 instances of the ManagedStopFilterFactory that use the same set of English stop words and we don't want 10 copies of the ManagedWordSetResource in the same core.