mirror of
https://github.com/milvus-io/milvus.git
synced 2026-07-21 10:15:43 +00:00
fix: change IO related rust unwrap to ? (#48333)
issue: https://github.com/milvus-io/milvus/issues/48320 --------- Signed-off-by: SpadeA <tangchenjie1210@gmail.com>
This commit is contained in:
@@ -45,11 +45,10 @@ impl IndexWriterWrapper {
|
||||
|
||||
let (schema, field) = build_ngram_schema(field_name);
|
||||
|
||||
let index = Index::create_in_dir(path, schema).unwrap();
|
||||
let index = Index::create_in_dir(path, schema)?;
|
||||
index.tokenizers().register(NGRAM_TOKENIZER, tokenizer);
|
||||
let index_writer = index
|
||||
.writer_with_num_threads(num_threads, overall_memory_budget_in_bytes)
|
||||
.unwrap();
|
||||
let index_writer =
|
||||
index.writer_with_num_threads(num_threads, overall_memory_budget_in_bytes)?;
|
||||
|
||||
Ok(IndexWriterWrapper::V7(IndexWriterWrapperImpl {
|
||||
field,
|
||||
|
||||
+3
-4
@@ -43,12 +43,11 @@ impl IndexWriterWrapperImpl {
|
||||
let index = if in_ram {
|
||||
Index::create_in_ram(schema)
|
||||
} else {
|
||||
Index::create_in_dir(path, schema).unwrap()
|
||||
Index::create_in_dir(path, schema)?
|
||||
};
|
||||
index.tokenizers().register(tokenizer_name, tokenizer);
|
||||
let index_writer = index
|
||||
.writer_with_num_threads(num_threads, overall_memory_budget_in_bytes)
|
||||
.unwrap();
|
||||
let index_writer =
|
||||
index.writer_with_num_threads(num_threads, overall_memory_budget_in_bytes)?;
|
||||
|
||||
Ok(IndexWriterWrapperImpl {
|
||||
field,
|
||||
|
||||
+3
-4
@@ -44,12 +44,11 @@ impl IndexWriterWrapperImpl {
|
||||
let index = if in_ram {
|
||||
Index::create_in_ram(schema)
|
||||
} else {
|
||||
Index::create_in_dir(path, schema).unwrap()
|
||||
Index::create_in_dir(path, schema)?
|
||||
};
|
||||
index.tokenizers().register(analyzer_name, analyzer);
|
||||
let index_writer = index
|
||||
.writer_with_num_threads(num_threads, overall_memory_budget_in_bytes)
|
||||
.unwrap();
|
||||
let index_writer =
|
||||
index.writer_with_num_threads(num_threads, overall_memory_budget_in_bytes)?;
|
||||
|
||||
Ok(IndexWriterWrapperImpl {
|
||||
field,
|
||||
|
||||
@@ -22,7 +22,7 @@ pub fn index_exist(path: &str) -> bool {
|
||||
);
|
||||
return false;
|
||||
};
|
||||
let exists = Index::exists(&dir).unwrap();
|
||||
let exists = Index::exists(&dir).unwrap_or(false);
|
||||
if !exists {
|
||||
init_log();
|
||||
let files: Vec<_> = std::fs::read_dir(path)
|
||||
|
||||
Reference in New Issue
Block a user