Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: fix Snippet docstring. fixes #225 #226

Merged
merged 2 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/tutorials.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/snippet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def create_index(dir=None):
}"""
)
writer.commit()
writer.wait_merging_threads()
index.reload()
return index

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -167,6 +169,7 @@ def create_spanish_index():
}"""
)
writer.commit()
writer.wait_merging_threads()
index.reload()
return index

Expand Down
Loading