File tree Expand file tree Collapse file tree 5 files changed +20
-12
lines changed Expand file tree Collapse file tree 5 files changed +20
-12
lines changed Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " tantivy"
3
- version = " 0.13.2 "
3
+ version = " 0.16.0 "
4
4
readme = " README.md"
5
5
authors = [
" Damir Jelić <[email protected] >" ]
6
6
edition = " 2018"
@@ -15,8 +15,8 @@ pyo3-build-config = "0.15.1"
15
15
16
16
[dependencies ]
17
17
chrono = " 0.4.19"
18
- tantivy = " 0.13.2 "
19
- itertools = " 0.9 .0"
18
+ tantivy = " 0.16.1 "
19
+ itertools = " 0.10 .0"
20
20
futures = " 0.3.5"
21
21
22
22
[dependencies .pyo3 ]
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ impl Facet {
48
48
#[ classmethod]
49
49
fn from_string ( _cls : & PyType , facet_string : & str ) -> Facet {
50
50
Facet {
51
- inner : schema:: Facet :: from_text ( facet_string) ,
51
+ inner : schema:: Facet :: from ( facet_string) ,
52
52
}
53
53
}
54
54
Original file line number Diff line number Diff line change @@ -174,7 +174,11 @@ impl Index {
174
174
if reuse {
175
175
tv:: Index :: open_or_create ( directory, schema. inner . clone ( ) )
176
176
} else {
177
- tv:: Index :: create ( directory, schema. inner . clone ( ) )
177
+ tv:: Index :: create (
178
+ directory,
179
+ schema. inner . clone ( ) ,
180
+ tv:: IndexSettings :: default ( ) ,
181
+ )
178
182
}
179
183
. map_err ( to_pyerr) ?
180
184
}
@@ -277,7 +281,7 @@ impl Index {
277
281
#[ staticmethod]
278
282
fn exists ( path : & str ) -> PyResult < bool > {
279
283
let directory = MmapDirectory :: open ( path) . map_err ( to_pyerr) ?;
280
- Ok ( tv:: Index :: exists ( & directory) )
284
+ Ok ( tv:: Index :: exists ( & directory) . unwrap ( ) )
281
285
}
282
286
283
287
/// The schema of the current index.
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ use tantivy::schema;
6
6
7
7
use crate :: schema:: Schema ;
8
8
use std:: sync:: { Arc , RwLock } ;
9
+ use tantivy:: schema:: INDEXED ;
9
10
10
11
/// Tantivy has a very strict schema.
11
12
/// You need to specify in advance whether a field is indexed or not,
@@ -236,7 +237,7 @@ impl SchemaBuilder {
236
237
let builder = & mut self . builder ;
237
238
238
239
if let Some ( builder) = builder. write ( ) . unwrap ( ) . as_mut ( ) {
239
- builder. add_facet_field ( name) ;
240
+ builder. add_facet_field ( name, INDEXED ) ;
240
241
} else {
241
242
return Err ( exceptions:: PyValueError :: new_err (
242
243
"Schema builder object isn't valid anymore." ,
@@ -257,7 +258,7 @@ impl SchemaBuilder {
257
258
let builder = & mut self . builder ;
258
259
259
260
if let Some ( builder) = builder. write ( ) . unwrap ( ) . as_mut ( ) {
260
- builder. add_bytes_field ( name) ;
261
+ builder. add_bytes_field ( name, INDEXED ) ;
261
262
} else {
262
263
return Err ( exceptions:: PyValueError :: new_err (
263
264
"Schema builder object isn't valid anymore." ,
Original file line number Diff line number Diff line change @@ -196,7 +196,7 @@ impl Searcher {
196
196
#[ pyclass]
197
197
#[ derive( Clone , Debug ) ]
198
198
pub ( crate ) struct DocAddress {
199
- pub ( crate ) segment_ord : tv:: SegmentLocalId ,
199
+ pub ( crate ) segment_ord : tv:: SegmentOrdinal ,
200
200
pub ( crate ) doc : tv:: DocId ,
201
201
}
202
202
@@ -219,15 +219,18 @@ impl DocAddress {
219
219
impl From < & tv:: DocAddress > for DocAddress {
220
220
fn from ( doc_address : & tv:: DocAddress ) -> Self {
221
221
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 ,
224
224
}
225
225
}
226
226
}
227
227
228
228
impl Into < tv:: DocAddress > for & DocAddress {
229
229
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
+ }
231
234
}
232
235
}
233
236
You can’t perform that action at this time.
0 commit comments