Example usage for org.apache.lucene.analysis.core StopFilterFactory inform

List of usage examples for org.apache.lucene.analysis.core StopFilterFactory inform

Introduction

In this page you can find the example usage for org.apache.lucene.analysis.core StopFilterFactory inform.

Prototype

@Override
    public void inform(ResourceLoader loader) throws IOException 

Source Link

Usage

From source file:uk.gov.nationalarchives.discovery.taxonomy.common.config.LuceneIAViewConfiguration.java

License:Mozilla Public License

/**
 ************************* FilterFactories and Analyzers
 *///from   w  w  w  . j a va  2  s .  c om

public @Bean StopFilterFactory stopFilterFactory() {
    Map<String, String> stopFilterArgs = new HashMap<String, String>();
    stopFilterArgs.put("words", "stopwords.txt");
    stopFilterArgs.put("enablePositionIncrements", "true");
    stopFilterArgs.put("luceneMatchVersion", version);

    StopFilterFactory stopFilterFactory = new StopFilterFactory(stopFilterArgs);

    try {
        ResourceLoader loader = new ClasspathResourceLoader(getClass());
        stopFilterFactory.inform(loader);
    } catch (IOException e) {
        logger.error(".stopFilterFactory: an error occured while creating the Filter factory: {}",
                e.getMessage());
    }
    return stopFilterFactory;
}