org.apache.lucene.analysis
Class MockTokenFilter

java.lang.Object
  extended by org.apache.lucene.util.AttributeSource
      extended by org.apache.lucene.analysis.TokenStream
          extended by org.apache.lucene.analysis.TokenFilter
              extended by org.apache.lucene.analysis.MockTokenFilter
All Implemented Interfaces:
Closeable

public final class MockTokenFilter
extends TokenFilter

A tokenfilter for testing that removes terms accepted by a DFA.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.lucene.util.AttributeSource
AttributeSource.AttributeFactory, AttributeSource.State
 
Field Summary
static CharacterRunAutomaton EMPTY_STOPSET
          Empty set of stopwords
static CharacterRunAutomaton ENGLISH_STOPSET
          Set of common english stopwords
 
Fields inherited from class org.apache.lucene.analysis.TokenFilter
input
 
Constructor Summary
MockTokenFilter(TokenStream input, CharacterRunAutomaton filter)
          Create a new MockTokenFilter.
 
Method Summary
 boolean getEnablePositionIncrements()
           
 boolean incrementToken()
           
 void setEnablePositionIncrements(boolean enable)
          If true, this Filter will preserve positions of the incoming tokens (ie, accumulate and set position increments of the removed stop tokens).
 
Methods inherited from class org.apache.lucene.analysis.TokenFilter
close, end, reset
 
Methods inherited from class org.apache.lucene.util.AttributeSource
addAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, reflectAsString, reflectWith, restoreState
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_STOPSET

public static final CharacterRunAutomaton EMPTY_STOPSET
Empty set of stopwords


ENGLISH_STOPSET

public static final CharacterRunAutomaton ENGLISH_STOPSET
Set of common english stopwords

Constructor Detail

MockTokenFilter

public MockTokenFilter(TokenStream input,
                       CharacterRunAutomaton filter)
Create a new MockTokenFilter.

Parameters:
input - TokenStream to filter
filter - DFA representing the terms that should be removed.
Method Detail

incrementToken

public boolean incrementToken()
                       throws IOException
Specified by:
incrementToken in class TokenStream
Throws:
IOException

getEnablePositionIncrements

public boolean getEnablePositionIncrements()
See Also:
setEnablePositionIncrements(boolean)

setEnablePositionIncrements

public void setEnablePositionIncrements(boolean enable)
If true, this Filter will preserve positions of the incoming tokens (ie, accumulate and set position increments of the removed stop tokens).



Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.