Class LuceneAnalyzerUtil
java.lang.Object
org.apache.lucene.analysis.Analyzer
org.apache.nutch.scoring.similarity.util.LuceneAnalyzerUtil
- All Implemented Interfaces:
Closeable,AutoCloseable
public class LuceneAnalyzerUtil
extends org.apache.lucene.analysis.Analyzer
Creates a custom analyzer based on user provided inputs
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.apache.lucene.analysis.Analyzer
org.apache.lucene.analysis.Analyzer.ReuseStrategy, org.apache.lucene.analysis.Analyzer.TokenStreamComponents -
Field Summary
Fields inherited from class org.apache.lucene.analysis.Analyzer
GLOBAL_REUSE_STRATEGY, PER_FIELD_REUSE_STRATEGY -
Constructor Summary
ConstructorsConstructorDescriptionLuceneAnalyzerUtil(LuceneAnalyzerUtil.StemFilterType stemFilterType, boolean useStopFilter) Creates an analyzer instance based on Lucene default stopword set if the param useStopFilter is set to trueLuceneAnalyzerUtil(LuceneAnalyzerUtil.StemFilterType stemFilterType, List<String> stopWords, boolean addToDefault) Creates an analyzer instance based on user provided stop words. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.lucene.analysis.Analyzer.TokenStreamComponentscreateComponents(String fieldName) Methods inherited from class org.apache.lucene.analysis.Analyzer
attributeFactory, close, getOffsetGap, getPositionIncrementGap, getReuseStrategy, getVersion, initReader, initReaderForNormalization, normalize, normalize, setVersion, tokenStream, tokenStream
-
Constructor Details
-
LuceneAnalyzerUtil
Creates an analyzer instance based on Lucene default stopword set if the param useStopFilter is set to true- Parameters:
stemFilterType- a preferredLuceneAnalyzerUtil.StemFilterTypeto use. Can be one ofLuceneAnalyzerUtil.StemFilterType.PORTERSTEM_FILTER,LuceneAnalyzerUtil.StemFilterType.ENGLISHMINIMALSTEM_FILTER, orLuceneAnalyzerUtil.StemFilterType.NONEuseStopFilter- if true use the default Lucene stopword set, false otherwise
-
LuceneAnalyzerUtil
public LuceneAnalyzerUtil(LuceneAnalyzerUtil.StemFilterType stemFilterType, List<String> stopWords, boolean addToDefault) Creates an analyzer instance based on user provided stop words. If the param addToDefault is set to true, then user provided stop words will be added to the Lucene default stopset.- Parameters:
stemFilterType- a preferredLuceneAnalyzerUtil.StemFilterTypeto use. Can be one ofLuceneAnalyzerUtil.StemFilterType.PORTERSTEM_FILTER,LuceneAnalyzerUtil.StemFilterType.ENGLISHMINIMALSTEM_FILTER, orLuceneAnalyzerUtil.StemFilterType.NONEstopWords- aListof stop word StringsaddToDefault- if true the provided stop words will be added to the default Lucene stopword set, false otherwise
-
-
Method Details
-
createComponents
protected org.apache.lucene.analysis.Analyzer.TokenStreamComponents createComponents(String fieldName) - Specified by:
createComponentsin classorg.apache.lucene.analysis.Analyzer
-