File tree Expand file tree Collapse file tree 4 files changed +12
-13
lines changed
internal/core/thirdparty/tantivy/tantivy-binding/src Expand file tree Collapse file tree 4 files changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -45,11 +45,10 @@ impl IndexWriterWrapper {
4545
4646 let ( schema, field) = build_ngram_schema ( field_name) ;
4747
48- let index = Index :: create_in_dir ( path, schema) . unwrap ( ) ;
48+ let index = Index :: create_in_dir ( path, schema) ? ;
4949 index. tokenizers ( ) . register ( NGRAM_TOKENIZER , tokenizer) ;
50- let index_writer = index
51- . writer_with_num_threads ( num_threads, overall_memory_budget_in_bytes)
52- . unwrap ( ) ;
50+ let index_writer =
51+ index. writer_with_num_threads ( num_threads, overall_memory_budget_in_bytes) ?;
5352
5453 Ok ( IndexWriterWrapper :: V7 ( IndexWriterWrapperImpl {
5554 field,
Original file line number Diff line number Diff line change @@ -43,12 +43,11 @@ impl IndexWriterWrapperImpl {
4343 let index = if in_ram {
4444 Index :: create_in_ram ( schema)
4545 } else {
46- Index :: create_in_dir ( path, schema) . unwrap ( )
46+ Index :: create_in_dir ( path, schema) ?
4747 } ;
4848 index. tokenizers ( ) . register ( tokenizer_name, tokenizer) ;
49- let index_writer = index
50- . writer_with_num_threads ( num_threads, overall_memory_budget_in_bytes)
51- . unwrap ( ) ;
49+ let index_writer =
50+ index. writer_with_num_threads ( num_threads, overall_memory_budget_in_bytes) ?;
5251
5352 Ok ( IndexWriterWrapperImpl {
5453 field,
Original file line number Diff line number Diff line change @@ -43,12 +43,11 @@ impl IndexWriterWrapperImpl {
4343 let index = if in_ram {
4444 Index :: create_in_ram ( schema)
4545 } else {
46- Index :: create_in_dir ( path, schema) . unwrap ( )
46+ Index :: create_in_dir ( path, schema) ?
4747 } ;
4848 index. tokenizers ( ) . register ( tokenizer_name, tokenizer) ;
49- let index_writer = index
50- . writer_with_num_threads ( num_threads, overall_memory_budget_in_bytes)
51- . unwrap ( ) ;
49+ let index_writer =
50+ index. writer_with_num_threads ( num_threads, overall_memory_budget_in_bytes) ?;
5251
5352 Ok ( IndexWriterWrapperImpl {
5453 field,
Original file line number Diff line number Diff line change 11use crate :: error:: Result ;
2+ use crate :: log:: init_log;
23use core:: slice;
4+ use log:: info;
35use std:: collections:: HashSet ;
46use std:: ffi:: CStr ;
57use std:: ffi:: { c_char, c_void} ;
@@ -15,7 +17,7 @@ pub fn index_exist(path: &str) -> bool {
1517 let Ok ( dir) = MmapDirectory :: open ( path) else {
1618 return false ;
1719 } ;
18- Index :: exists ( & dir) . unwrap ( )
20+ Index :: exists ( & dir) . unwrap_or ( false )
1921}
2022
2123pub fn make_bounds < T > ( bound : T , inclusive : bool ) -> Bound < T > {
You can’t perform that action at this time.
0 commit comments