Bump tantivy version 0.16.0 (#34)

* Bump version 0.14
* Bump version 0.15
* Bump version 0.16
master
huishan 2022-01-03 21:51:13 +08:00 committed by GitHub
parent eba3f60346
commit 338ac950f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 12 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "tantivy" name = "tantivy"
version = "0.13.2" version = "0.16.0"
readme = "README.md" readme = "README.md"
authors = ["Damir Jelić <poljar@termina.org.uk>"] authors = ["Damir Jelić <poljar@termina.org.uk>"]
edition = "2018" edition = "2018"
@ -15,8 +15,8 @@ pyo3-build-config = "0.15.1"
[dependencies] [dependencies]
chrono = "0.4.19" chrono = "0.4.19"
tantivy = "0.13.2" tantivy = "0.16.1"
itertools = "0.9.0" itertools = "0.10.0"
futures = "0.3.5" futures = "0.3.5"
[dependencies.pyo3] [dependencies.pyo3]

View File

@ -48,7 +48,7 @@ impl Facet {
#[classmethod] #[classmethod]
fn from_string(_cls: &PyType, facet_string: &str) -> Facet { fn from_string(_cls: &PyType, facet_string: &str) -> Facet {
Facet { Facet {
inner: schema::Facet::from_text(facet_string), inner: schema::Facet::from(facet_string),
} }
} }

View File

@ -174,7 +174,11 @@ impl Index {
if reuse { if reuse {
tv::Index::open_or_create(directory, schema.inner.clone()) tv::Index::open_or_create(directory, schema.inner.clone())
} else { } else {
tv::Index::create(directory, schema.inner.clone()) tv::Index::create(
directory,
schema.inner.clone(),
tv::IndexSettings::default(),
)
} }
.map_err(to_pyerr)? .map_err(to_pyerr)?
} }
@ -277,7 +281,7 @@ impl Index {
#[staticmethod] #[staticmethod]
fn exists(path: &str) -> PyResult<bool> { fn exists(path: &str) -> PyResult<bool> {
let directory = MmapDirectory::open(path).map_err(to_pyerr)?; 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. /// The schema of the current index.

View File

@ -6,6 +6,7 @@ use tantivy::schema;
use crate::schema::Schema; use crate::schema::Schema;
use std::sync::{Arc, RwLock}; use std::sync::{Arc, RwLock};
use tantivy::schema::INDEXED;
/// Tantivy has a very strict schema. /// Tantivy has a very strict schema.
/// You need to specify in advance whether a field is indexed or not, /// You need to specify in advance whether a field is indexed or not,
@ -236,7 +237,7 @@ impl SchemaBuilder {
let builder = &mut self.builder; let builder = &mut self.builder;
if let Some(builder) = builder.write().unwrap().as_mut() { if let Some(builder) = builder.write().unwrap().as_mut() {
builder.add_facet_field(name); builder.add_facet_field(name, INDEXED);
} else { } else {
return Err(exceptions::PyValueError::new_err( return Err(exceptions::PyValueError::new_err(
"Schema builder object isn't valid anymore.", "Schema builder object isn't valid anymore.",
@ -257,7 +258,7 @@ impl SchemaBuilder {
let builder = &mut self.builder; let builder = &mut self.builder;
if let Some(builder) = builder.write().unwrap().as_mut() { if let Some(builder) = builder.write().unwrap().as_mut() {
builder.add_bytes_field(name); builder.add_bytes_field(name, INDEXED);
} else { } else {
return Err(exceptions::PyValueError::new_err( return Err(exceptions::PyValueError::new_err(
"Schema builder object isn't valid anymore.", "Schema builder object isn't valid anymore.",

View File

@ -196,7 +196,7 @@ impl Searcher {
#[pyclass] #[pyclass]
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub(crate) struct DocAddress { pub(crate) struct DocAddress {
pub(crate) segment_ord: tv::SegmentLocalId, pub(crate) segment_ord: tv::SegmentOrdinal,
pub(crate) doc: tv::DocId, pub(crate) doc: tv::DocId,
} }
@ -219,15 +219,18 @@ impl DocAddress {
impl From<&tv::DocAddress> for DocAddress { impl From<&tv::DocAddress> for DocAddress {
fn from(doc_address: &tv::DocAddress) -> Self { fn from(doc_address: &tv::DocAddress) -> Self {
DocAddress { DocAddress {
segment_ord: doc_address.segment_ord(), segment_ord: doc_address.segment_ord,
doc: doc_address.doc(), doc: doc_address.doc_id,
} }
} }
} }
impl Into<tv::DocAddress> for &DocAddress { impl Into<tv::DocAddress> for &DocAddress {
fn into(self) -> tv::DocAddress { fn into(self) -> tv::DocAddress {
tv::DocAddress(self.segment_ord(), self.doc()) tv::DocAddress {
segment_ord: self.segment_ord(),
doc_id: self.doc(),
}
} }
} }