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 <zhicheng.yue@zilliz.com>
This commit is contained in:
aoiasd 2025-09-15 10:30:00 +08:00 committed by GitHub
parent 5d54d84438
commit cb0bb7b31f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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()
}