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]
name = "tantivy"
version = "0.13.2"
version = "0.16.0"
readme = "README.md"
authors = ["Damir Jelić <poljar@termina.org.uk>"]
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]

View File

@ -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),
}
}

View File

@ -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<bool> {
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.

View File

@ -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.",

View File

@ -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<tv::DocAddress> 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(),
}
}
}