From cb0bb7b31f927e51a5369b0c7952f6f6c625fc2b Mon Sep 17 00:00:00 2001 From: aoiasd <45024769+aoiasd@users.noreply.github.com> Date: Mon, 15 Sep 2025 10:30:00 +0800 Subject: [PATCH] enhance: [2.5] forbid panic when tantivy index path not exist (#44136) pr: https://github.com/milvus-io/milvus/pull/44135 Signed-off-by: aoiasd --- internal/core/thirdparty/tantivy/tantivy-binding/src/util.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/core/thirdparty/tantivy/tantivy-binding/src/util.rs b/internal/core/thirdparty/tantivy/tantivy-binding/src/util.rs index cb489f04b8..b2241db721 100644 --- a/internal/core/thirdparty/tantivy/tantivy-binding/src/util.rs +++ b/internal/core/thirdparty/tantivy/tantivy-binding/src/util.rs @@ -5,7 +5,9 @@ use std::ops::Bound; use tantivy::{directory::MmapDirectory, Index}; pub fn index_exist(path: &str) -> bool { - let dir = MmapDirectory::open(path).unwrap(); + let Ok(dir) = MmapDirectory::open(path) else { + return false; + }; Index::exists(&dir).unwrap() }