parent
5975efcf30
commit
e9363e71d8
|
@ -64,8 +64,12 @@ writer.add_document(tantivy.Document(
|
|||
))
|
||||
# ... and committing
|
||||
writer.commit()
|
||||
writer.wait_merging_threads()
|
||||
```
|
||||
|
||||
Note that `wait_merging_threads()` must come at the end, because
|
||||
the `writer` object will not be usable after this call.
|
||||
|
||||
## Building and Executing Queries
|
||||
|
||||
First you need to get a searcher for the index
|
||||
|
|
|
@ -2,10 +2,10 @@ use crate::to_pyerr;
|
|||
use pyo3::prelude::*;
|
||||
use tantivy as tv;
|
||||
|
||||
/// Tantivy schema.
|
||||
/// Tantivy Snippet
|
||||
///
|
||||
/// The schema is very strict. To build the schema the `SchemaBuilder` class is
|
||||
/// provided.
|
||||
/// Snippet contains a fragment of a document, and some highlighted
|
||||
/// parts inside it.
|
||||
#[pyclass(module = "tantivy.tantivy")]
|
||||
pub(crate) struct Snippet {
|
||||
pub(crate) inner: tv::Snippet,
|
||||
|
|
|
@ -73,6 +73,7 @@ def create_index(dir=None):
|
|||
}"""
|
||||
)
|
||||
writer.commit()
|
||||
writer.wait_merging_threads()
|
||||
index.reload()
|
||||
return index
|
||||
|
||||
|
@ -117,6 +118,7 @@ def create_index_with_numeric_fields(dir=None):
|
|||
)
|
||||
writer.add_document(doc)
|
||||
writer.commit()
|
||||
writer.wait_merging_threads()
|
||||
index.reload()
|
||||
return index
|
||||
|
||||
|
@ -167,6 +169,7 @@ def create_spanish_index():
|
|||
}"""
|
||||
)
|
||||
writer.commit()
|
||||
writer.wait_merging_threads()
|
||||
index.reload()
|
||||
return index
|
||||
|
||||
|
|
Loading…
Reference in New Issue