Skip to content

Commit 338ac95

Browse files
authored
Bump tantivy version 0.16.0 (#34)
* Bump version 0.14 * Bump version 0.15 * Bump version 0.16
1 parent eba3f60 commit 338ac95

File tree

5 files changed

+20
-12
lines changed

5 files changed

+20
-12
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "tantivy"
3-
version = "0.13.2"
3+
version = "0.16.0"
44
readme = "README.md"
55
authors = ["Damir Jelić <[email protected]>"]
66
edition = "2018"
@@ -15,8 +15,8 @@ pyo3-build-config = "0.15.1"
1515

1616
[dependencies]
1717
chrono = "0.4.19"
18-
tantivy = "0.13.2"
19-
itertools = "0.9.0"
18+
tantivy = "0.16.1"
19+
itertools = "0.10.0"
2020
futures = "0.3.5"
2121

2222
[dependencies.pyo3]

src/facet.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl Facet {
4848
#[classmethod]
4949
fn from_string(_cls: &PyType, facet_string: &str) -> Facet {
5050
Facet {
51-
inner: schema::Facet::from_text(facet_string),
51+
inner: schema::Facet::from(facet_string),
5252
}
5353
}
5454

src/index.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,11 @@ impl Index {
174174
if reuse {
175175
tv::Index::open_or_create(directory, schema.inner.clone())
176176
} else {
177-
tv::Index::create(directory, schema.inner.clone())
177+
tv::Index::create(
178+
directory,
179+
schema.inner.clone(),
180+
tv::IndexSettings::default(),
181+
)
178182
}
179183
.map_err(to_pyerr)?
180184
}
@@ -277,7 +281,7 @@ impl Index {
277281
#[staticmethod]
278282
fn exists(path: &str) -> PyResult<bool> {
279283
let directory = MmapDirectory::open(path).map_err(to_pyerr)?;
280-
Ok(tv::Index::exists(&directory))
284+
Ok(tv::Index::exists(&directory).unwrap())
281285
}
282286

283287
/// The schema of the current index.

src/schemabuilder.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use tantivy::schema;
66

77
use crate::schema::Schema;
88
use std::sync::{Arc, RwLock};
9+
use tantivy::schema::INDEXED;
910

1011
/// Tantivy has a very strict schema.
1112
/// You need to specify in advance whether a field is indexed or not,
@@ -236,7 +237,7 @@ impl SchemaBuilder {
236237
let builder = &mut self.builder;
237238

238239
if let Some(builder) = builder.write().unwrap().as_mut() {
239-
builder.add_facet_field(name);
240+
builder.add_facet_field(name, INDEXED);
240241
} else {
241242
return Err(exceptions::PyValueError::new_err(
242243
"Schema builder object isn't valid anymore.",
@@ -257,7 +258,7 @@ impl SchemaBuilder {
257258
let builder = &mut self.builder;
258259

259260
if let Some(builder) = builder.write().unwrap().as_mut() {
260-
builder.add_bytes_field(name);
261+
builder.add_bytes_field(name, INDEXED);
261262
} else {
262263
return Err(exceptions::PyValueError::new_err(
263264
"Schema builder object isn't valid anymore.",

src/searcher.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ impl Searcher {
196196
#[pyclass]
197197
#[derive(Clone, Debug)]
198198
pub(crate) struct DocAddress {
199-
pub(crate) segment_ord: tv::SegmentLocalId,
199+
pub(crate) segment_ord: tv::SegmentOrdinal,
200200
pub(crate) doc: tv::DocId,
201201
}
202202

@@ -219,15 +219,18 @@ impl DocAddress {
219219
impl From<&tv::DocAddress> for DocAddress {
220220
fn from(doc_address: &tv::DocAddress) -> Self {
221221
DocAddress {
222-
segment_ord: doc_address.segment_ord(),
223-
doc: doc_address.doc(),
222+
segment_ord: doc_address.segment_ord,
223+
doc: doc_address.doc_id,
224224
}
225225
}
226226
}
227227

228228
impl Into<tv::DocAddress> for &DocAddress {
229229
fn into(self) -> tv::DocAddress {
230-
tv::DocAddress(self.segment_ord(), self.doc())
230+
tv::DocAddress {
231+
segment_ord: self.segment_ord(),
232+
doc_id: self.doc(),
233+
}
231234
}
232235
}
233236

0 commit comments

Comments
 (0)