This is an automated email from the ASF dual-hosted git repository.

jianliangqi pushed a commit to branch clucene
in repository https://gitbox.apache.org/repos/asf/doris-thirdparty.git


The following commit(s) were added to refs/heads/clucene by this push:
     new f1eccdde78 [Fix](ram) fix ram directory seek last problem (#202)
f1eccdde78 is described below

commit f1eccdde780528cb4fb13f169f0bed6d8558d698
Author: airborne12 <airborn...@gmail.com>
AuthorDate: Mon Mar 18 21:39:25 2024 +0800

    [Fix](ram) fix ram directory seek last problem (#202)
---
 src/core/CLucene/store/RAMDirectory.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/core/CLucene/store/RAMDirectory.cpp 
b/src/core/CLucene/store/RAMDirectory.cpp
index 768b2f4d47..c9b2efd611 100644
--- a/src/core/CLucene/store/RAMDirectory.cpp
+++ b/src/core/CLucene/store/RAMDirectory.cpp
@@ -351,6 +351,9 @@ int64_t RAMInputStream::getFilePointer() const {
 void RAMInputStream::seek(const int64_t pos) {
     if (currentBuffer == NULL || pos < bufferStart || pos >= bufferStart + 
BUFFER_SIZE) {
         currentBufferIndex = (int32_t) (pos / BUFFER_SIZE);
+        if (currentBufferIndex == file->numBuffers()) {
+            return;
+        }
         switchCurrentBuffer();
     }
     bufferPosition = (int32_t) (pos % BUFFER_SIZE);


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

Reply via email to