You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "mikemccand (via GitHub)" <gi...@apache.org> on 2024/04/01 15:15:17 UTC

Re: [PR] Avoid SegmentTermsEnumFrame reload block. [lucene]

mikemccand commented on code in PR #13253:
URL: https://github.com/apache/lucene/pull/13253#discussion_r1546429761


##########
lucene/core/src/java/org/apache/lucene/codecs/lucene90/blocktree/SegmentTermsEnumFrame.java:
##########
@@ -284,6 +284,61 @@ void rewind() {
     */
   }
 
+  // Only rewind, don't force reload block.
+  // Reset reader position, don't read, decompress.
+  // Current term greater than target, reduce endCount.
+  void rewind2() {

Review Comment:
   Maybe rename to `rewindWithoutReload` or so?  Or if we think we can fully replace all `rewind` with this new approach then we can keep the name `rewind` :)



##########
lucene/core/src/java/org/apache/lucene/codecs/lucene90/blocktree/SegmentTermsEnum.java:
##########
@@ -309,6 +309,7 @@ private boolean setEOF() {
   @Override
   public boolean seekExact(BytesRef target) throws IOException {
 
+    int originEndCount = -1;

Review Comment:
   Rename to `origEntCount`?



##########
lucene/core/src/java/org/apache/lucene/codecs/lucene90/blocktree/SegmentTermsEnumFrame.java:
##########
@@ -284,6 +284,61 @@ void rewind() {
     */
   }
 
+  // Only rewind, don't force reload block.
+  // Reset reader position, don't read, decompress.
+  // Current term greater than target, reduce endCount.
+  void rewind2() {
+
+    // Force reload:
+    fp = fpOrig;
+    // TODO: Reset entCount after this seek.
+    entCount = nextEnt;

Review Comment:
   Maybe caller could do this sleight-of-hand?  It seems dangerous to do this down so low, because it's caller that must do that `TODO` (restore the original `entCount`).



-- 
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-unsubscribe@lucene.apache.org

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


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