You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Yonik Seeley <yo...@lucidimagination.com> on 2009/09/18 01:57:44 UTC

analysis back compat break

Unfortunately it doesn't look like analysis is actually back compatible.

http://search.lucidimagination.com/search/document/26c044ecbce3ed29

Consider the following token filter snippet that used to work fine:

  public Token next(Token target) throws IOException {
    input.next(target);
    Token peek = input.next();

What I'm seeing now is that the target and peek tokens are both the same.
This is because the "input" stream supports incrementToken and thus
incrementToken() is called first, changing "target".

Relevant code from TokenStream:
  public Token next() throws IOException {
    if (tokenWrapper == null)
      throw new UnsupportedOperationException("This TokenStream only
supports the new Attributes API.");

    if (supportedMethods.hasIncrementToken) {
      return incrementToken() ? ((Token) tokenWrapper.delegate.clone()) : null;


-Yonik
http://www.lucidimagination.com

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org