java.lang.Object | ||||
↳ | org.apache.lucene.util.AttributeSource | |||
↳ | org.apache.lucene.analysis.TokenStream | |||
↳ | org.apache.lucene.analysis.TokenFilter | |||
↳ | org.apache.lucene.analysis.StopFilter |
Removes stop words from a token stream.
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.lucene.analysis.TokenFilter
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Construct a token stream filtering the given input.
| |||||||||||
Constructs a filter which removes words from the input
TokenStream that are named in the Set.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns version-dependent default for
enablePositionIncrements.
| |||||||||||
Returns the next input Token whose term() is not a stop word.
| |||||||||||
Builds a Set from an array of stop words,
appropriate for passing into the StopFilter constructor.
| |||||||||||
Builds a Set from an array of stop words,
appropriate for passing into the StopFilter constructor.
| |||||||||||
If
true , this StopFilter will preserve
positions of the incoming tokens (ie, accumulate and
set position increments of the removed stop tokens). |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.lucene.analysis.TokenFilter
| |||||||||||
From class
org.apache.lucene.analysis.TokenStream
| |||||||||||
From class
org.apache.lucene.util.AttributeSource
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
java.io.Closeable
|
Construct a token stream filtering the given input.
If stopWords
is an instance of CharArraySet
(true if
makeStopSet()
was used to construct the set) it will be directly used
and ignoreCase
will be ignored since CharArraySet
directly controls case sensitivity.
stopWords
is not an instance of CharArraySet
,
a new CharArraySet will be constructed and ignoreCase
will be
used to specify the case sensitivity of that set.enablePositionIncrements | true if token positions should record the removed stop words |
---|---|
input | Input TokenStream |
stopWords | A Set of Strings or char[] or any other toString()-able set representing the stopwords |
ignoreCase | if true, all words are lower cased first |
Constructs a filter which removes words from the input TokenStream that are named in the Set.
enablePositionIncrements | true if token positions should record the removed stop words |
---|---|
in | Input stream |
stopWords | A Set of Strings or char[] or any other toString()-able set representing the stopwords |
Returns version-dependent default for enablePositionIncrements. Analyzers that embed StopFilter use this method when creating the StopFilter. Prior to 2.9, this returns false. On 2.9 or later, it returns true.
Returns the next input Token whose term() is not a stop word.
IOException |
---|
Builds a Set from an array of stop words, appropriate for passing into the StopFilter constructor. This permits this stopWords construction to be cached once when an Analyzer is constructed.
stopWords | A List of Strings or char[] or any other toString()-able list representing the stopwords |
---|---|
ignoreCase | if true, all words are lower cased first |
CharArraySet
) containing the words
Builds a Set from an array of stop words, appropriate for passing into the StopFilter constructor. This permits this stopWords construction to be cached once when an Analyzer is constructed.
stopWords | A List of Strings or char[] or any other toString()-able list representing the stopwords |
---|
CharArraySet
) containing the wordsstopWords | An array of stopwords |
---|---|
ignoreCase | If true, all words are lower cased first. |
If true
, this StopFilter will preserve
positions of the incoming tokens (ie, accumulate and
set position increments of the removed stop tokens).
Generally, true
is best as it does not
lose information (positions of the original tokens)
during indexing.
When set, when a token is stopped (omitted), the position increment of the following token is incremented.
NOTE: be sure to also
set setEnablePositionIncrements(boolean)
if
you use QueryParser to create queries.