[
https://issues.apache.org/jira/browse/LUCENE-9096?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17008628#comment-17008628
]
ASF subversion and git services commented on LUCENE-9096:
---------------------------------------------------------
Commit 7d6067000cdfcece70c15ce74a5727e56729fdc4 in lucene-solr's branch
refs/heads/branch_8x from kkewwei
[ https://gitbox.apache.org/repos/asf?p=lucene-solr.git;h=7d60670 ]
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: [email protected]
For additional commands, e-mail: [email protected]