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 8b305872 [Fix](multi segment) fix multisegment doc overflow (#174)
8b305872 is described below

commit 8b305872ea3155a98ebb1487d6afae36ba410731
Author: airborne12 <airborn...@gmail.com>
AuthorDate: Tue Jan 9 20:53:42 2024 +0800

    [Fix](multi segment) fix multisegment doc overflow (#174)
---
 src/core/CLucene/index/MultiSegmentReader.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/core/CLucene/index/MultiSegmentReader.cpp 
b/src/core/CLucene/index/MultiSegmentReader.cpp
index ad37807e..b4be5f01 100644
--- a/src/core/CLucene/index/MultiSegmentReader.cpp
+++ b/src/core/CLucene/index/MultiSegmentReader.cpp
@@ -561,6 +561,10 @@ int32_t MultiTermDocs::docFreq() {
 
 int32_t MultiTermDocs::doc() const {
   CND_PRECONDITION(current!=NULL,"current==NULL, check that next() was 
called");
+  // if not found term, current will return INT_MAX, we could not add base, 
otherwise it will overflow.
+  if (current->doc() == LUCENE_INT32_MAX_SHOULDBE) {
+      return LUCENE_INT32_MAX_SHOULDBE;
+  }
   return base + current->doc();
 }
 int32_t MultiTermDocs::freq() const {


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

Reply via email to