From 0e2fc2eae6780892b17f1951488cbe8d71a45da4 Mon Sep 17 00:00:00 2001 From: Joakim Soderlund Date: Sat, 4 Jun 2022 22:50:43 +0200 Subject: [PATCH] Fix build from Tantivy changes --- search/Cargo.toml | 2 +- search/src/lib.rs | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/search/Cargo.toml b/search/Cargo.toml index 6a82059..057b617 100644 --- a/search/Cargo.toml +++ b/search/Cargo.toml @@ -2,7 +2,7 @@ name = "fimfareader-search" version = "0.1.0" authors = ["Joakim Soderlund "] -edition = "2018" +edition = "2021" [dependencies.fimfareader] path = ".." diff --git a/search/src/lib.rs b/search/src/lib.rs index bb8f0a9..b069e64 100644 --- a/search/src/lib.rs +++ b/search/src/lib.rs @@ -12,15 +12,16 @@ use std::time::Instant; use rayon::iter::ParallelIterator; use zip::read::ZipArchive; +use tantivy::Index; +use tantivy::IndexSettings; +use tantivy::ReloadPolicy; use tantivy::collector::TopDocs; use tantivy::directory::MmapDirectory; use tantivy::query::QueryParser; -use tantivy::schema; use tantivy::schema::Document; use tantivy::schema::Schema; use tantivy::schema::Value; -use tantivy::Index; -use tantivy::ReloadPolicy; +use tantivy::schema; use thread_local::ThreadLocal; @@ -73,7 +74,8 @@ impl Searcher { std::fs::create_dir_all(&directory).unwrap(); let store = MmapDirectory::open(&directory).unwrap(); - let index = Index::create(store, schema).unwrap(); + let settings = IndexSettings::default(); + let index = Index::create(store, schema, settings).unwrap(); let schema = index.schema(); let sid = schema.get_field("sid").unwrap(); @@ -116,7 +118,7 @@ impl Searcher { text.clear(); } - writer.add_document(doc); + writer.add_document(doc).unwrap(); }); writer.commit().unwrap();