Class CustomAnalyzer
java.lang.Object
org.apache.lucene.analysis.Analyzer
org.apache.lucene.analysis.ReusableAnalyzerBase
org.apache.lucene.analysis.StopwordAnalyzerBase
sk.iway.iwcm.system.fulltext.lucene.CustomAnalyzer
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class CustomAnalyzer
extends org.apache.lucene.analysis.StopwordAnalyzerBase
CustomAnalyzer
Applies Lemmatising ONLY on fields DATA and TITLE
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.lucene.analysis.ReusableAnalyzerBase
org.apache.lucene.analysis.ReusableAnalyzerBase.TokenStreamComponents
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Default maximum allowed token lengthFields inherited from class org.apache.lucene.analysis.StopwordAnalyzerBase
matchVersion, stopwords
-
Constructor Summary
ConstructorsConstructorDescriptionCustomAnalyzer
(org.apache.lucene.util.Version matchVersion, String language) Builds an analyzer with the default stop words. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.lucene.analysis.ReusableAnalyzerBase.TokenStreamComponents
createComponents
(String fieldName, Reader reader) int
void
setMaxTokenLength
(int length) Set maximum allowed token length.Methods inherited from class org.apache.lucene.analysis.StopwordAnalyzerBase
getStopwordSet, loadStopwordSet, loadStopwordSet, loadStopwordSet
Methods inherited from class org.apache.lucene.analysis.ReusableAnalyzerBase
initReader, reusableTokenStream, tokenStream
Methods inherited from class org.apache.lucene.analysis.Analyzer
close, getOffsetGap, getPositionIncrementGap, getPreviousTokenStream, setPreviousTokenStream
-
Field Details
-
DEFAULT_MAX_TOKEN_LENGTH
public static final int DEFAULT_MAX_TOKEN_LENGTHDefault maximum allowed token length- See Also:
-
-
Constructor Details
-
CustomAnalyzer
Builds an analyzer with the default stop words.- Parameters:
matchVersion
- Lucene version to match
-
-
Method Details
-
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:
-
createComponents
protected org.apache.lucene.analysis.ReusableAnalyzerBase.TokenStreamComponents createComponents(String fieldName, Reader reader) - Specified by:
createComponents
in classorg.apache.lucene.analysis.ReusableAnalyzerBase
-