org.apache.lucene.analysis.miscellaneous
Class PrefixAwareTokenFilter

java.lang.Object
  extended by org.apache.lucene.analysis.TokenStream
      extended by org.apache.lucene.analysis.miscellaneous.PrefixAwareTokenFilter

public class PrefixAwareTokenFilter
extends TokenStream

Joins two token streams and leaves the last token of the first stream available to be used when updating the token values in the second stream based on that token. The default implementation adds last prefix token end offset to the suffix token start and end offsets.


Constructor Summary
PrefixAwareTokenFilter(TokenStream prefix, TokenStream suffix)
           
 
Method Summary
 void close()
           
 TokenStream getPrefix()
           
 TokenStream getSuffix()
           
 Token next(Token reusableToken)
           
 void reset()
           
 void setPrefix(TokenStream prefix)
           
 void setSuffix(TokenStream suffix)
           
 Token updateSuffixToken(Token suffixToken, Token lastPrefixToken)
          The default implementation adds last prefix token end offset to the suffix token start and end offsets.
 
Methods inherited from class org.apache.lucene.analysis.TokenStream
next
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrefixAwareTokenFilter

public PrefixAwareTokenFilter(TokenStream prefix,
                              TokenStream suffix)
Method Detail

next

public Token next(Token reusableToken)
           throws IOException
Overrides:
next in class TokenStream
Throws:
IOException

updateSuffixToken

public Token updateSuffixToken(Token suffixToken,
                               Token lastPrefixToken)
The default implementation adds last prefix token end offset to the suffix token start and end offsets.

Parameters:
suffixToken - a token from the suffix stream
lastPrefixToken - the last token from the prefix stream
Returns:
consumer token

close

public void close()
           throws IOException
Overrides:
close in class TokenStream
Throws:
IOException

reset

public void reset()
           throws IOException
Overrides:
reset in class TokenStream
Throws:
IOException

getPrefix

public TokenStream getPrefix()

setPrefix

public void setPrefix(TokenStream prefix)

getSuffix

public TokenStream getSuffix()

setSuffix

public void setSuffix(TokenStream suffix)


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