Class SuggestStopFilterFactory
- java.lang.Object
-
- org.apache.lucene.analysis.util.AbstractAnalysisFactory
-
- org.apache.lucene.analysis.util.TokenFilterFactory
-
- org.apache.lucene.search.suggest.analyzing.SuggestStopFilterFactory
-
- All Implemented Interfaces:
ResourceLoaderAware
public class SuggestStopFilterFactory extends TokenFilterFactory implements ResourceLoaderAware
Factory forSuggestStopFilter.<fieldType name="autosuggest" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true"> <analyzer> <tokenizer class="solr.WhitespaceTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.SuggestStopFilterFactory" ignoreCase="true" words="stopwords.txt" format="wordset"/> </analyzer> </fieldType>All attributes are optional:
ignoreCasedefaults tofalsewordsshould be the name of a stopwords file to parse, if not specified the factory will useEnglishAnalyzer.ENGLISH_STOP_WORDS_SETformatdefines how thewordsfile will be parsed, and defaults towordset. Ifwordsis not specified, thenformatmust not be specified.
The valid values for the
formatoption are:wordset- This is the default format, which supports one word per line (including any intra-word whitespace) and allows whole line comments beginning with the "#" character. Blank lines are ignored. SeeWordlistLoader.getLinesfor details.snowball- This format allows for multiple words specified on each line, and trailing comments may be specified using the vertical line ("|"). Blank lines are ignored. SeeWordlistLoader.getSnowballWordSetfor details.
- Since:
- 5.0.0
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringformatstatic java.lang.StringFORMAT_SNOWBALLmultiple words may be specified on each line, trailing comments start with "|"static java.lang.StringFORMAT_WORDSETthe default format, one word per line, whole line comments start with "#"private booleanignoreCasestatic java.lang.StringNAMESPI nameprivate java.lang.StringstopWordFilesprivate CharArraySetstopWords-
Fields inherited from class org.apache.lucene.analysis.util.AbstractAnalysisFactory
LUCENE_MATCH_VERSION_PARAM, luceneMatchVersion
-
-
Constructor Summary
Constructors Constructor Description SuggestStopFilterFactory(java.util.Map<java.lang.String,java.lang.String> args)Creates a new StopFilterFactory
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TokenStreamcreate(TokenStream input)Transform the specified input TokenStreamCharArraySetgetStopWords()Returns the configured stopword setvoidinform(ResourceLoader loader)Initializes this component with the provided ResourceLoader (used for loading classes, files, etc).booleanisIgnoreCase()Whether or not to ignore case-
Methods inherited from class org.apache.lucene.analysis.util.TokenFilterFactory
availableTokenFilters, findSPIName, forName, lookupClass, normalize, reloadTokenFilters
-
Methods inherited from class org.apache.lucene.analysis.util.AbstractAnalysisFactory
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
-
NAME
public static final java.lang.String NAME
SPI name- See Also:
- Constant Field Values
-
FORMAT_WORDSET
public static final java.lang.String FORMAT_WORDSET
the default format, one word per line, whole line comments start with "#"- See Also:
- Constant Field Values
-
FORMAT_SNOWBALL
public static final java.lang.String FORMAT_SNOWBALL
multiple words may be specified on each line, trailing comments start with "|"- See Also:
- Constant Field Values
-
stopWords
private CharArraySet stopWords
-
stopWordFiles
private final java.lang.String stopWordFiles
-
format
private final java.lang.String format
-
ignoreCase
private final boolean ignoreCase
-
-
Method Detail
-
inform
public void inform(ResourceLoader loader) throws java.io.IOException
Description copied from interface:ResourceLoaderAwareInitializes this component with the provided ResourceLoader (used for loading classes, files, etc).- Specified by:
informin interfaceResourceLoaderAware- Throws:
java.io.IOException
-
isIgnoreCase
public boolean isIgnoreCase()
Whether or not to ignore case
-
getStopWords
public CharArraySet getStopWords()
Returns the configured stopword set
-
create
public TokenStream create(TokenStream input)
Description copied from class:TokenFilterFactoryTransform the specified input TokenStream- Specified by:
createin classTokenFilterFactory
-
-