George Rhoten created LUCENE-5112:
-------------------------------------

             Summary: FilteringTokenFilter is double incrementing the position 
increment in incrementToken
                 Key: LUCENE-5112
                 URL: https://issues.apache.org/jira/browse/LUCENE-5112
             Project: Lucene - Core
          Issue Type: Bug
          Components: modules/analysis
    Affects Versions: 4.0
            Reporter: George Rhoten


The following code from FilteringTokenFilter#incrementToken() seems wrong.
{noformat}
    if (enablePositionIncrements) {
      int skippedPositions = 0;
      while (input.incrementToken()) {
        if (accept()) {
          if (skippedPositions != 0) {
            posIncrAtt.setPositionIncrement(posIncrAtt.getPositionIncrement() + 
skippedPositions);
          }
          return true;
        }
        skippedPositions += posIncrAtt.getPositionIncrement();
      }
    } else {
{noformat} 
The skippedPositions variable should probably be incremented by 1 instead of 
posIncrAtt.getPositionIncrement(). As it is, it seems to be double 
incrementing, which is a problem if your data is full of stop words and your 
position increment integer overflows.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to