mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-07 01:28:27 +08:00
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:
parent
5d54d84438
commit
cb0bb7b31f
@ -5,7 +5,9 @@ use std::ops::Bound;
|
|||||||
use tantivy::{directory::MmapDirectory, Index};
|
use tantivy::{directory::MmapDirectory, Index};
|
||||||
|
|
||||||
pub fn index_exist(path: &str) -> bool {
|
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()
|
Index::exists(&dir).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user