easyice commented on code in PR #12997:
URL: https://github.com/apache/lucene/pull/12997#discussion_r1444747244


##########
lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99PostingsReader.java:
##########
@@ -399,7 +400,9 @@ public PostingsEnum reset(IntBlockTermState termState, int 
flags) throws IOExcep
       doc = -1;
       this.needsFreq = PostingsEnum.featureRequested(flags, 
PostingsEnum.FREQS);
       this.isFreqsRead = true;
-      if (indexHasFreq == false || needsFreq == false) {
+      // if reuse, we don't consider whether the needsFreq is changed. this is 
undefined in freq().
+      // see also: BasePostingsFormatTestCase#testPostingsEnumFreqs
+      if ((indexHasFreq == false || needsFreq == false) && reuse == false) {

Review Comment:
   Thank you for explaining @jpountz! makes sense to me, the only problem is 
the `PostingsEnum#freq()` method might return 0, although this is undefined, is 
this looks good?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to