The StopFilter type exposes the following members.

Methods

  NameDescription
Public methodAddAttribute
The caller must pass in a Class<? extends Attribute> value. This method first checks if an instance of that class is already in this AttributeSource and returns it. Otherwise a new instance is created, added to this AttributeSource and returned. Signature for Java 1.5:
CopyC#
public <T extends Attribute> T addAttribute(Class<T>)
(Inherited from AttributeSource.)
Public methodAddAttributeImpl
Adds a custom AttributeImpl instance with one or more Attribute interfaces.
(Inherited from AttributeSource.)
Public methodCaptureState
Captures the state of all Attributes. The return value can be passed to {@link #restoreState} to restore the state of this or another AttributeSource.
(Inherited from AttributeSource.)
Public methodClearAttributes
Resets all Attributes in this AttributeSource by calling {@link AttributeImpl#Clear()} on each Attribute implementation.
(Inherited from AttributeSource.)
Public methodCloneAttributes
Performs a clone of all {@link AttributeImpl} instances returned in a new AttributeSource instance. This method can be used to e.g. create another TokenStream with exactly the same attributes (using {@link #AttributeSource(AttributeSource)})
(Inherited from AttributeSource.)
Public methodClose
Close the input TokenStream.
(Inherited from TokenFilter.)
Public methodEnd
Performs end-of-stream operations, if any, and calls then
CopyC#
end()
on the input TokenStream.

NOTE: Be sure to call

CopyC#
super.end()
first when overriding this method.
(Inherited from TokenFilter.)
Public methodEquals (Inherited from AttributeSource.)
Protected methodFinalize
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetAttribute
The caller must pass in a Class<? extends Attribute> value. Returns the instance of the passed in Attribute contained in this AttributeSource Signature for Java 1.5:
CopyC#
public <T extends Attribute> T getAttribute(Class<T>)
(Inherited from AttributeSource.)
Public methodGetAttributeClassesIterator
Returns a new iterator that iterates the attribute classes in the same order they were added in. Signature for Java 1.5:
CopyC#
public Iterator<Class<? extends Attribute>> getAttributeClassesIterator()
Note that this return value is different from Java in that it enumerates over the values and not the keys
(Inherited from AttributeSource.)
Public methodGetAttributeFactory
returns the used AttributeFactory.
(Inherited from AttributeSource.)
Public methodGetAttributeImplsIterator
Returns a new iterator that iterates all unique Attribute implementations. This iterator may contain less entries that {@link #getAttributeClassesIterator}, if one instance implements more than one Attribute interface. Signature for Java 1.5:
CopyC#
public Iterator<AttributeImpl> getAttributeImplsIterator()
(Inherited from AttributeSource.)
Public methodGetEnablePositionIncrements
Public methodStatic memberGetEnablePositionIncrementsDefault Obsolete.
Public methodStatic memberGetEnablePositionIncrementsVersionDefault
Returns version-dependent default for enablePositionIncrements. Analyzers that embed StopFilter use this method when creating the StopFilter. Prior to 2.9, this returns {@link #getEnablePositionIncrementsDefault}. On 2.9 or later, it returns true.
Public methodGetHashCode (Inherited from AttributeSource.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodHasAttribute
The caller must pass in a Class<? extends Attribute> value. Returns true, iff this AttributeSource contains the passed-in Attribute. Signature for Java 1.5:
CopyC#
public boolean hasAttribute(Class<? extends Attribute>)
(Inherited from AttributeSource.)
Public methodHasAttributes
Returns true, iff this AttributeSource has any attributes
(Inherited from AttributeSource.)
Public methodIncrementToken
Returns the next input Token whose term() is not a stop word.
(Overrides TokenStream..::..IncrementToken()()()().)
Public methodInit
Public methodStatic memberMakeStopSet(IList)
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.
Public methodStatic memberMakeStopSet(array<String>[]()[][])
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.
Public methodStatic memberMakeStopSet(IList, Boolean)
Public methodStatic memberMakeStopSet(array<String>[]()[][], Boolean)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodNext()()()() Obsolete.
Returns the next {@link Token} in the stream, or null at EOS.
(Inherited from TokenStream.)
Public methodNext(Token) Obsolete.
Returns the next token in the stream, or null at EOS. When possible, the input Token should be used as the returned Token (this gives fastest tokenization performance), but this is not required and a new Token may be returned. Callers may re-use a single Token instance for successive calls to this method. This implicitly defines a "contract" between consumers (callers of this method) and producers (implementations of this method that are the source for tokens):
  • A consumer must fully consume the previously returned {@link Token} before calling this method again.
  • A producer must call {@link Token#Clear()} before setting the fields in it and returning it
Also, the producer must make no assumptions about a {@link Token} after it has been returned: the caller may arbitrarily change it. If the producer needs to hold onto the {@link Token} for subsequent calls, it must clone() it before storing it. Note that a {@link TokenFilter} is considered a consumer.
(Inherited from TokenStream.)
Public methodReset
Reset the filter as well as the input TokenStream.
(Inherited from TokenFilter.)
Public methodRestoreState
Restores this state by copying the values of all attribute implementations that this state contains into the attributes implementations of the targetStream. The targetStream must contain a corresponding instance for each argument contained in this state (e.g. it is not possible to restore the state of an AttributeSource containing a TermAttribute into a AttributeSource using a Token instance as implementation). Note that this method does not affect attributes of the targetStream that are not contained in this state. In other words, if for example the targetStream contains an OffsetAttribute, but this state doesn't, then the value of the OffsetAttribute remains unchanged. It might be desirable to reset its value to the default, in which case the caller should first call {@link TokenStream#ClearAttributes()} on the targetStream.
(Inherited from AttributeSource.)
Public methodSetEnablePositionIncrements
If
CopyC#
true
, this StopFilter will preserve positions of the incoming tokens (ie, accumulate and set position increments of the removed stop tokens). Generally,
CopyC#
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 {@link QueryParser#setEnablePositionIncrements} if you use QueryParser to create queries.

Public methodStatic memberSetEnablePositionIncrementsDefault Obsolete.
Set the default position increments behavior of every StopFilter created from now on.

Note: behavior of a single StopFilter instance can be modified with {@link #SetEnablePositionIncrements(boolean)}. This static method allows control over behavior of classes using StopFilters internally, for example {@link Lucene.Net.Analysis.Standard.StandardAnalyzer StandardAnalyzer} if used with the no-arg ctor.

Default : false.

Public methodToString (Inherited from AttributeSource.)

See Also