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