Class CaseSensitiveContextualAnalyzer
java.lang.Object
org.apache.lucene.analysis.Analyzer
ddf.catalog.pubsub.criteria.contextual.CaseSensitiveContextualAnalyzer
- All Implemented Interfaces:
Closeable,AutoCloseable
public class CaseSensitiveContextualAnalyzer
extends org.apache.lucene.analysis.Analyzer
Filters
StandardTokenizer with StandardFilter, LowerCaseFilter and StopFilter, using a list of English stop
words.
You must specify the required Version compatibility when creating StandardAnalyzer:
- As of 2.9, StopFilter preserves position increments
- As of 2.4, Tokens incorrectly identified as acronyms are corrected (see LUCENE-1608
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault maximum allowed token lengthprotected static final Set<?>An unmodifiable set containing some common English words that are usually not useful for searching.Fields inherited from class org.apache.lucene.analysis.Analyzer
overridesTokenStreamMethod -
Constructor Summary
ConstructorsConstructorDescriptionCaseSensitiveContextualAnalyzer(org.apache.lucene.util.Version matchVersion) Builds an analyzer with the default stop words (STOP_WORDS_SET).CaseSensitiveContextualAnalyzer(org.apache.lucene.util.Version matchVersion, File stopwords) Builds an analyzer with the stop words from the given file.CaseSensitiveContextualAnalyzer(org.apache.lucene.util.Version matchVersion, Reader stopwords) Builds an analyzer with the stop words from the given reader.CaseSensitiveContextualAnalyzer(org.apache.lucene.util.Version matchVersion, Set<?> stopWords) Builds an analyzer with the given stop words. -
Method Summary
Modifier and TypeMethodDescriptionintorg.apache.lucene.analysis.TokenStreamreusableTokenStream(String fieldName, Reader reader) voidsetMaxTokenLength(int length) Set maximum allowed token length.org.apache.lucene.analysis.TokenStreamtokenStream(String fieldName, Reader reader) Constructs aStandardTokenizerfiltered by aStandardFilter, aLowerCaseFilterand aStopFilter.Methods inherited from class org.apache.lucene.analysis.Analyzer
close, getOffsetGap, getPositionIncrementGap, getPreviousTokenStream, setOverridesTokenStreamMethod, setPreviousTokenStream
-
Field Details
-
STOP_WORDS_SET
An unmodifiable set containing some common English words that are usually not useful for searching. -
DEFAULT_MAX_TOKEN_LENGTH
public static final int DEFAULT_MAX_TOKEN_LENGTHDefault maximum allowed token length- See Also:
-
-
Constructor Details
-
CaseSensitiveContextualAnalyzer
public CaseSensitiveContextualAnalyzer(org.apache.lucene.util.Version matchVersion) Builds an analyzer with the default stop words (STOP_WORDS_SET).- Parameters:
matchVersion- Lucene version to match See {@link <a href="#version">above</a>}
-
CaseSensitiveContextualAnalyzer
public CaseSensitiveContextualAnalyzer(org.apache.lucene.util.Version matchVersion, Set<?> stopWords) Builds an analyzer with the given stop words.- Parameters:
matchVersion- Lucene version to match See {@link <a href="#version">above</a>}stopWords- stop words
-
CaseSensitiveContextualAnalyzer
public CaseSensitiveContextualAnalyzer(org.apache.lucene.util.Version matchVersion, File stopwords) throws IOException Builds an analyzer with the stop words from the given file.- Parameters:
matchVersion- Lucene version to match See {@link <a href="#version">above</a>}stopwords- File to read stop words from- Throws:
IOException- See Also:
-
WordlistLoader.getWordSet(File)
-
CaseSensitiveContextualAnalyzer
public CaseSensitiveContextualAnalyzer(org.apache.lucene.util.Version matchVersion, Reader stopwords) throws IOException Builds an analyzer with the stop words from the given reader.- Parameters:
matchVersion- Lucene version to match See {@link <a href="#version">above</a>}stopwords- Reader to read stop words from- Throws:
IOException- See Also:
-
WordlistLoader.getWordSet(Reader)
-
-
Method Details
-
tokenStream
Constructs aStandardTokenizerfiltered by aStandardFilter, aLowerCaseFilterand aStopFilter.- Specified by:
tokenStreamin classorg.apache.lucene.analysis.Analyzer
-
getMaxTokenLength
public int getMaxTokenLength()- See Also:
-
setMaxTokenLength
public void setMaxTokenLength(int length) Set maximum allowed token length. If a token is seen that exceeds this length then it is discarded. This setting only takes effect the next time tokenStream or reusableTokenStream is called. -
reusableTokenStream
public org.apache.lucene.analysis.TokenStream reusableTokenStream(String fieldName, Reader reader) throws IOException - Overrides:
reusableTokenStreamin classorg.apache.lucene.analysis.Analyzer- Throws:
IOException
-