diff --git a/Cargo.toml b/Cargo.toml index ac0b6a8..d9c3ec3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tantivy" -version = "0.13.2" +version = "0.16.0" readme = "README.md" authors = ["Damir Jelić "] edition = "2018" @@ -15,8 +15,8 @@ pyo3-build-config = "0.15.1" [dependencies] chrono = "0.4.19" -tantivy = "0.13.2" -itertools = "0.9.0" +tantivy = "0.16.1" +itertools = "0.10.0" futures = "0.3.5" [dependencies.pyo3] diff --git a/src/facet.rs b/src/facet.rs index 82144e2..72fdd4f 100644 --- a/src/facet.rs +++ b/src/facet.rs @@ -48,7 +48,7 @@ impl Facet { #[classmethod] fn from_string(_cls: &PyType, facet_string: &str) -> Facet { Facet { - inner: schema::Facet::from_text(facet_string), + inner: schema::Facet::from(facet_string), } } diff --git a/src/index.rs b/src/index.rs index 8934753..7a93082 100644 --- a/src/index.rs +++ b/src/index.rs @@ -174,7 +174,11 @@ impl Index { if reuse { tv::Index::open_or_create(directory, schema.inner.clone()) } else { - tv::Index::create(directory, schema.inner.clone()) + tv::Index::create( + directory, + schema.inner.clone(), + tv::IndexSettings::default(), + ) } .map_err(to_pyerr)? } @@ -277,7 +281,7 @@ impl Index { #[staticmethod] fn exists(path: &str) -> PyResult { let directory = MmapDirectory::open(path).map_err(to_pyerr)?; - Ok(tv::Index::exists(&directory)) + Ok(tv::Index::exists(&directory).unwrap()) } /// The schema of the current index. diff --git a/src/schemabuilder.rs b/src/schemabuilder.rs index 58b2a27..e3735fb 100644 --- a/src/schemabuilder.rs +++ b/src/schemabuilder.rs @@ -6,6 +6,7 @@ use tantivy::schema; use crate::schema::Schema; use std::sync::{Arc, RwLock}; +use tantivy::schema::INDEXED; /// Tantivy has a very strict schema. /// You need to specify in advance whether a field is indexed or not, @@ -236,7 +237,7 @@ impl SchemaBuilder { let builder = &mut self.builder; if let Some(builder) = builder.write().unwrap().as_mut() { - builder.add_facet_field(name); + builder.add_facet_field(name, INDEXED); } else { return Err(exceptions::PyValueError::new_err( "Schema builder object isn't valid anymore.", @@ -257,7 +258,7 @@ impl SchemaBuilder { let builder = &mut self.builder; if let Some(builder) = builder.write().unwrap().as_mut() { - builder.add_bytes_field(name); + builder.add_bytes_field(name, INDEXED); } else { return Err(exceptions::PyValueError::new_err( "Schema builder object isn't valid anymore.", diff --git a/src/searcher.rs b/src/searcher.rs index 2f0cc1b..33e33cb 100644 --- a/src/searcher.rs +++ b/src/searcher.rs @@ -196,7 +196,7 @@ impl Searcher { #[pyclass] #[derive(Clone, Debug)] pub(crate) struct DocAddress { - pub(crate) segment_ord: tv::SegmentLocalId, + pub(crate) segment_ord: tv::SegmentOrdinal, pub(crate) doc: tv::DocId, } @@ -219,15 +219,18 @@ impl DocAddress { impl From<&tv::DocAddress> for DocAddress { fn from(doc_address: &tv::DocAddress) -> Self { DocAddress { - segment_ord: doc_address.segment_ord(), - doc: doc_address.doc(), + segment_ord: doc_address.segment_ord, + doc: doc_address.doc_id, } } } impl Into for &DocAddress { fn into(self) -> tv::DocAddress { - tv::DocAddress(self.segment_ord(), self.doc()) + tv::DocAddress { + segment_ord: self.segment_ord(), + doc_id: self.doc(), + } } }