org.apache.lucene.analysis.standard
Class StandardAnalyzer
- java.lang.Object
-
- org.apache.lucene.analysis.Analyzer
-
- org.apache.lucene.analysis.standard.StandardAnalyzer
-
public class StandardAnalyzer extends Analyzer
FiltersStandardTokenizerwithStandardFilter,LowerCaseFilterandStopFilter, using a list of English stop words.
-
-
Field Summary
Fields Modifier and Type Field and Description static intDEFAULT_MAX_TOKEN_LENGTHDefault maximum allowed token lengthstatic java.lang.String[]STOP_WORDSAn array containing some common English words that are usually not useful for searching.
-
Constructor Summary
Constructors Constructor and Description StandardAnalyzer()Builds an analyzer with the default stop words (STOP_WORDS).StandardAnalyzer(boolean replaceInvalidAcronym)Deprecated.Remove in 3.X and make true the only valid valueStandardAnalyzer(java.io.File stopwords)Builds an analyzer with the stop words from the given file.StandardAnalyzer(java.io.File stopwords, boolean replaceInvalidAcronym)Deprecated.Remove in 3.X and make true the only valid valueStandardAnalyzer(java.io.Reader stopwords)Builds an analyzer with the stop words from the given reader.StandardAnalyzer(java.io.Reader stopwords, boolean replaceInvalidAcronym)Deprecated.Remove in 3.X and make true the only valid valueStandardAnalyzer(java.util.Set stopWords)Builds an analyzer with the given stop words.StandardAnalyzer(java.util.Set stopwords, boolean replaceInvalidAcronym)Deprecated.Remove in 3.X and make true the only valid valueStandardAnalyzer(java.lang.String[] stopWords)Builds an analyzer with the given stop words.StandardAnalyzer(java.lang.String[] stopwords, boolean replaceInvalidAcronym)Deprecated.Remove in 3.X and make true the only valid value
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intgetMaxTokenLength()booleanisReplaceInvalidAcronym()TokenStreamreusableTokenStream(java.lang.String fieldName, java.io.Reader reader)Creates a TokenStream that is allowed to be re-used from the previous time that the same thread called this method.voidsetMaxTokenLength(int length)Set maximum allowed token length.voidsetReplaceInvalidAcronym(boolean replaceInvalidAcronym)TokenStreamtokenStream(java.lang.String fieldName, java.io.Reader reader)-
Methods inherited from class org.apache.lucene.analysis.Analyzer
getPositionIncrementGap
-
-
-
-
Field Detail
-
STOP_WORDS
public static final java.lang.String[] STOP_WORDS
An array containing some common English words that are usually not useful for searching.
-
DEFAULT_MAX_TOKEN_LENGTH
public static final int DEFAULT_MAX_TOKEN_LENGTH
Default maximum allowed token length- See Also:
- Constant Field Values
-
-
Constructor Detail
-
StandardAnalyzer
public StandardAnalyzer()
Builds an analyzer with the default stop words (STOP_WORDS).
-
StandardAnalyzer
public StandardAnalyzer(java.util.Set stopWords)
Builds an analyzer with the given stop words.
-
StandardAnalyzer
public StandardAnalyzer(java.lang.String[] stopWords)
Builds an analyzer with the given stop words.
-
StandardAnalyzer
public StandardAnalyzer(java.io.File stopwords) throws java.io.IOExceptionBuilds an analyzer with the stop words from the given file.- Throws:
java.io.IOException- See Also:
WordlistLoader.getWordSet(File)
-
StandardAnalyzer
public StandardAnalyzer(java.io.Reader stopwords) throws java.io.IOExceptionBuilds an analyzer with the stop words from the given reader.- Throws:
java.io.IOException- See Also:
WordlistLoader.getWordSet(Reader)
-
StandardAnalyzer
public StandardAnalyzer(boolean replaceInvalidAcronym)
Deprecated. Remove in 3.X and make true the only valid value- Parameters:
replaceInvalidAcronym- Set to true if this analyzer should replace mischaracterized acronyms in the StandardTokenizer See https://issues.apache.org/jira/browse/LUCENE-1068
-
StandardAnalyzer
public StandardAnalyzer(java.io.Reader stopwords, boolean replaceInvalidAcronym) throws java.io.IOExceptionDeprecated. Remove in 3.X and make true the only valid value- Parameters:
stopwords- The stopwords to usereplaceInvalidAcronym- Set to true if this analyzer should replace mischaracterized acronyms in the StandardTokenizer See https://issues.apache.org/jira/browse/LUCENE-1068- Throws:
java.io.IOException
-
StandardAnalyzer
public StandardAnalyzer(java.io.File stopwords, boolean replaceInvalidAcronym) throws java.io.IOExceptionDeprecated. Remove in 3.X and make true the only valid value- Parameters:
stopwords- The stopwords to usereplaceInvalidAcronym- Set to true if this analyzer should replace mischaracterized acronyms in the StandardTokenizer See https://issues.apache.org/jira/browse/LUCENE-1068- Throws:
java.io.IOException
-
StandardAnalyzer
public StandardAnalyzer(java.lang.String[] stopwords, boolean replaceInvalidAcronym) throws java.io.IOExceptionDeprecated. Remove in 3.X and make true the only valid value- Parameters:
stopwords- The stopwords to usereplaceInvalidAcronym- Set to true if this analyzer should replace mischaracterized acronyms in the StandardTokenizer See https://issues.apache.org/jira/browse/LUCENE-1068- Throws:
java.io.IOException
-
StandardAnalyzer
public StandardAnalyzer(java.util.Set stopwords, boolean replaceInvalidAcronym) throws java.io.IOExceptionDeprecated. Remove in 3.X and make true the only valid value- Parameters:
stopwords- The stopwords to usereplaceInvalidAcronym- Set to true if this analyzer should replace mischaracterized acronyms in the StandardTokenizer See https://issues.apache.org/jira/browse/LUCENE-1068- Throws:
java.io.IOException
-
-
Method Detail
-
tokenStream
public TokenStream tokenStream(java.lang.String fieldName, java.io.Reader reader)
- Specified by:
tokenStreamin classAnalyzer
-
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.
-
getMaxTokenLength
public int getMaxTokenLength()
- See Also:
setMaxTokenLength(int)
-
reusableTokenStream
public TokenStream reusableTokenStream(java.lang.String fieldName, java.io.Reader reader) throws java.io.IOException
Description copied from class:AnalyzerCreates a TokenStream that is allowed to be re-used from the previous time that the same thread called this method. Callers that do not need to use more than one TokenStream at the same time from this analyzer should use this method for better performance.- Overrides:
reusableTokenStreamin classAnalyzer- Throws:
java.io.IOException
-
isReplaceInvalidAcronym
public boolean isReplaceInvalidAcronym()
- Returns:
- true if this Analyzer is replacing mischaracterized acronyms in the StandardTokenizer See https://issues.apache.org/jira/browse/LUCENE-1068
-
setReplaceInvalidAcronym
public void setReplaceInvalidAcronym(boolean replaceInvalidAcronym)
- Parameters:
replaceInvalidAcronym- Set to true if this Analyzer is replacing mischaracterized acronyms in the StandardTokenizer See https://issues.apache.org/jira/browse/LUCENE-1068
-
-
DataMelt 3.0 © DataMelt by jWork.ORG