jpountz commented on a change in pull request #595: Load freqs lazily in 
Postings
URL: https://github.com/apache/lucene-solr/pull/595#discussion_r262438369
 
 

 ##########
 File path: 
lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsReader.java
 ##########
 @@ -330,10 +331,15 @@ public PostingsEnum reset(IntBlockTermState termState, 
int flags) throws IOExcep
       skipped = false;
       return this;
     }
-    
+
+    // lazy loading of frequencies
     @Override
     public int freq() throws IOException {
-      return freq;
+      if (indexHasFreq && needsFreq && (isFreqDecoded == false)) {
 
 Review comment:
   nit: this might be called for every doc while refillDocs is called more 
rarely. I'm wondering whether we could simplify this condition so that it would 
only be `if (isFreqDecoded == false) {`, ie. make sure that `isFreqDecoded is 
always `true` when the index doesn't have freqs or if freqs are not needed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to