[ https://issues.apache.org/jira/browse/LUCENE-9096?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17009439#comment-17009439 ]
ASF subversion and git services commented on LUCENE-9096: --------------------------------------------------------- Commit 2db4c909ca10c0d7edd9999a0c94622fa1369833 in lucene-solr's branch refs/heads/gradle-master from kkewwei [ https://gitbox.apache.org/repos/asf?p=lucene-solr.git;h=2db4c90 ] LUCENE-9096:Simplify CompressingTermVectorsWriter#flushOffsets. (#1125) > Implementation of CompressingTermVectorsWriter.flushOffsets can be simpler > -------------------------------------------------------------------------- > > Key: LUCENE-9096 > URL: https://issues.apache.org/jira/browse/LUCENE-9096 > Project: Lucene - Core > Issue Type: Improvement > Components: core/codecs > Affects Versions: 8.2 > Reporter: kkewwei > Priority: Major > Fix For: 8.5 > > Time Spent: 40m > Remaining Estimate: 0h > > In CompressingTermVectorsWriter.flushOffsets, we count > sumPos and sumOffsets by the way > {code:java} > for (int i = 0; i < fd.numTerms; ++i) { > int previousPos = 0; > int previousOff = 0; > for (int j = 0; j < fd.freqs[i]; ++j) { > final int position = positionsBuf[fd.posStart + pos]; > final int startOffset = startOffsetsBuf[fd.offStart + pos]; > sumPos[fieldNumOff] += position - previousPos; > sumOffsets[fieldNumOff] += startOffset - previousOff; > previousPos = position; > previousOff = startOffset; > ++pos; > } > } > {code} > we always use the position - previousPos, it can be summarized like this: > {code:java} > (position5-position4)+(position4-position3)+(position3-position2)+(position2-position1){code} > If we should simplify it: position5-position1 > -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org