com.atlassian.jira.issue.index.analyzer
Class StemmingAnalyzer

java.lang.Object
  extended by org.apache.lucene.analysis.Analyzer
      extended by com.atlassian.jira.issue.index.analyzer.StemmingAnalyzer
All Implemented Interfaces:
Closeable

public class StemmingAnalyzer
extends org.apache.lucene.analysis.Analyzer

A TextAnalyzer that takes in a set of stop words and a stem filter as a function to apply to the text being analyzed.


Constructor Summary
StemmingAnalyzer(org.apache.lucene.util.Version matchVersion, boolean indexing, Set<?> stopWords, com.google.common.base.Function<org.apache.lucene.analysis.TokenStream,org.apache.lucene.analysis.TokenStream> stemmingFilter)
           
 
Method Summary
 boolean isIndexing()
           
 org.apache.lucene.analysis.TokenStream reusableTokenStream(String fieldName, Reader reader)
           
 org.apache.lucene.analysis.TokenStream tokenStream(String fieldname, Reader reader)
           
protected  org.apache.lucene.analysis.TokenStream wrapStreamForIndexing(org.apache.lucene.analysis.TokenStream input)
          Applies a SubtokenFilter to the input token stream at document indexing time.
protected  org.apache.lucene.analysis.TokenStream wrapStreamForWilcardSearchSupport(org.apache.lucene.analysis.TokenStream input)
          Applies a KeywordRepeatFilter to the input token stream at document indexing time to store the original tokens as keywords before any stemming filter is applied and therefore support wildcard searches and exact phrase queries on document fields.
 
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
 

Constructor Detail

StemmingAnalyzer

public StemmingAnalyzer(org.apache.lucene.util.Version matchVersion,
                        boolean indexing,
                        Set<?> stopWords,
                        com.google.common.base.Function<org.apache.lucene.analysis.TokenStream,org.apache.lucene.analysis.TokenStream> stemmingFilter)
Method Detail

tokenStream

public final org.apache.lucene.analysis.TokenStream tokenStream(String fieldname,
                                                                Reader reader)
Specified by:
tokenStream in class org.apache.lucene.analysis.Analyzer

isIndexing

public boolean isIndexing()

wrapStreamForIndexing

protected org.apache.lucene.analysis.TokenStream wrapStreamForIndexing(org.apache.lucene.analysis.TokenStream input)
Applies a SubtokenFilter to the input token stream at document indexing time.

Parameters:
input - token stream
Returns:
A TokenStream filtered by the sub-token filter during indexing, otherwise the input token stream is returned.

wrapStreamForWilcardSearchSupport

protected org.apache.lucene.analysis.TokenStream wrapStreamForWilcardSearchSupport(org.apache.lucene.analysis.TokenStream input)
Applies a KeywordRepeatFilter to the input token stream at document indexing time to store the original tokens as keywords before any stemming filter is applied and therefore support wildcard searches and exact phrase queries on document fields.

Parameters:
input - token stream
Returns:
A TokenStream filtered by the sub-token filter during indexing, otherwise the input token stream is returned.

reusableTokenStream

public final org.apache.lucene.analysis.TokenStream reusableTokenStream(String fieldName,
                                                                        Reader reader)
                                                                 throws IOException
Overrides:
reusableTokenStream in class org.apache.lucene.analysis.Analyzer
Throws:
IOException


Copyright © 2002-2014 Atlassian. All Rights Reserved.