fix(core): remove all unwraps, fix unpolled futures, and fix search index memory leak on restart

This commit is contained in:
Riz Ashraf committed 2026-09-21 18:54:19 +01:00
1 parent ae0ea9ab22
commit 7dc0c329ad
9 files changed
+45 -59

No files matched your search

+6 -3
View File
@@ -30,11 +30,14 @@ impl MemoryIndex {
let schema = schema_builder.build();
let index_dir = store_dir.join("tantivy_index");
std::fs::create_dir_all(&index_dir).unwrap();
std::fs::create_dir_all(&index_dir)
.map_err(|e| tantivy::TantivyError::SystemError(e.to_string()))?;
let index = Index::open_in_dir(&index_dir)
.unwrap_or_else(|_| Index::create_in_dir(&index_dir, schema.clone()).unwrap());
.or_else(|_| Index::create_in_dir(&index_dir, schema.clone()))?;
let writer = index.writer(50_000_000)?;
let mut writer = index.writer(50_000_000)?;
writer.delete_all_documents()?;
writer.commit()?;
let reader = index
.reader_builder()
.reload_policy(ReloadPolicy::OnCommitWithDelay)