Interface CustomAnalyzerWrapperFactory


  • public interface CustomAnalyzerWrapperFactory
    This factory allows us to extend the granularity used when configuring Analyzer instances.

    For example, with normal configuration, Analyzers can only be applied to fields that start with a pre-defined prefix.
    • For example: use the FilenameAnalyzer for all fields with the key "projectRoot"
    However, you can not use regular expressions when configuring Analyzers normally, which means that it is impossible to configure an analyzer if you have a set of fields that have a pre-defined prefix but a dynamically-determined suffix (and we have that for change impact).

    This factory allows us to define our own Analyzer which can have its own logic to deal with this problem.

    This is then the primary Analyzer defined for the Lucene engine. If the logic in this (wrapper) Analyzer does not match a field, it then delegates the field to the Analyzers defined in the fieldAnalyzer parameter.

    (At least, that's an example of what it can and should do, but that's up to the implementation details).
    See Also:
    LuceneConfigBuilder#withDefaultAnalyzer(), LuceneConfigBuilder#usingAnalyzerWrapperFactory(CustomAnalyzerWrapperFactory)
    • Method Detail

      • getAnalyzerWrapper

        org.apache.lucene.analysis.Analyzer getAnalyzerWrapper​(org.apache.lucene.analysis.Analyzer defaultAnalyzer,
                                                               Map<String,​org.apache.lucene.analysis.Analyzer> fieldAnalyzers)