Interface LuceneAnalyzerFactory

All Known Implementing Classes:
EmailCjkSynonymAnalyzerFactory, ExactTokenAnalyzerFactory, LuceneAutoCompleteAnalyzerFactory, NgramAnalyzer.NgramAnalyzerFactory, SynonymAnalyzer.AuthoritativeSynonymOnlyAnalyzerFactory, SynonymAnalyzer.QueryOnlySynonymAnalyzerFactory

public interface LuceneAnalyzerFactory
Each implementation of Analyzer should have its own implementation of this factory interface to provide instances of the analyzers for indexing and query to a LuceneAnalyzerRegistry. The registry will populate a mapping of names to analyzers using the methods of this interface.
See Also:
  • Method Details

    • getName

      @Nonnull String getName()
      Get the unique name for the Lucene analyzer factory. This is the name that should be included in the index meta-data in order to indicate that this analyzer factory should be used within a certain index.
      Returns:
      the name of the analyzer that this factory creates
    • getType

      @Nonnull LuceneAnalyzerType getType()
      Get the LuceneAnalyzerType for the Lucene analyzer factory.
      Returns:
      the LuceneScanTypes used to determine how the analyzers build by this factory is used
    • getIndexAnalyzerChooser

      @Nonnull AnalyzerChooser getIndexAnalyzerChooser(@Nonnull Index index)
      Get an instance of AnalyzerChooser that chooses the Lucene analyzer based on texts for indexing, given the Index. For a given factory, each indexing analyzer chosen should be of the same type, and it should match the result of getName().
      Parameters:
      index - the index thi analyzer is used for
      Returns:
      an instance of the AnalyzerChooser for indexing that this factory creates
    • getQueryAnalyzerChooser

      @Nonnull default AnalyzerChooser getQueryAnalyzerChooser(@Nonnull Index index, @Nonnull AnalyzerChooser indexAnalyzerChooser)
      Get an instance of AnalyzerChooser that chooses the Lucene analyzer for query given the Index. For a given factory, each query analyzer chosen should be of the same type, and it should match the result of getName(). Call getIndexAnalyzerChooser(Index) before calling this method, and use its return for the argument indexAnalyzerChooser. No need to override this method if StandardAnalyzer is to be used for query time. Override this method to customize the analyzer for query time, or directly return the indexAnalyzerChooser instance, if it is used for both indexing and query time.
      Parameters:
      index - the index the analyzer is used for
      indexAnalyzerChooser - indexAnalyzerChooser the instance of AnalyzerChooser for indexing used by this factory, that can be returned by this method in case it is also used for query
      Returns:
      an instance of the AnalyzerChooser for query that this factory creates, the default one is always using StandardAnalyzer