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

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Default maximum allowed token length

    Fields inherited from class org.apache.lucene.analysis.StopwordAnalyzerBase

    matchVersion, stopwords
  • Constructor Summary

    Constructors
    Constructor
    Description
    CustomAnalyzer(org.apache.lucene.util.Version matchVersion, String language)
    Builds an analyzer with the default stop words.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected 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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_MAX_TOKEN_LENGTH

      public static final int DEFAULT_MAX_TOKEN_LENGTH
      Default maximum allowed token length
      See Also:
  • Constructor Details

    • CustomAnalyzer

      public CustomAnalyzer(org.apache.lucene.util.Version matchVersion, String language)
      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 class org.apache.lucene.analysis.ReusableAnalyzerBase