[
https://issues.apache.org/jira/browse/LUCENE-5112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13708388#comment-13708388
]
Michael McCandless commented on LUCENE-5112:
--------------------------------------------
I think the code is correct: we accumulate posInc of all tokens that were not
accepted, plus the final posInc of the token that was accepted. I don't see
how this leads to integer overflows when a StopFilter is used ... can you make
a contained test showing that?
> 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]