You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Uwe Schindler (JIRA)" <ji...@apache.org> on 2013/07/15 21:04:48 UTC

[jira] [Closed] (LUCENE-5112) FilteringTokenFilter is double incrementing the position increment in incrementToken

     [ https://issues.apache.org/jira/browse/LUCENE-5112?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler closed LUCENE-5112.
---------------------------------

    
> 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
>            Assignee: Uwe Schindler
>
> 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: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org