lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yonik Seeley <yo...@lucidimagination.com>
Subject analysis back compat break
Date Thu, 17 Sep 2009 23:57:44 GMT
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


Mime
View raw message