doc: fix Snippet docstring. fixes #225 (#226)

master
Caleb Hattingh 2024-03-22 01:47:33 +01:00 committed by GitHub
parent 5975efcf30
commit e9363e71d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 3 deletions

View File

@ -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

View File

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

View File

@ -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