From e9363e71d8faa85405b6e62ea332aff651b1585f Mon Sep 17 00:00:00 2001 From: Caleb Hattingh Date: Fri, 22 Mar 2024 01:47:33 +0100 Subject: [PATCH] doc: fix Snippet docstring. fixes #225 (#226) --- docs/tutorials.md | 4 ++++ src/snippet.rs | 6 +++--- tests/conftest.py | 3 +++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/tutorials.md b/docs/tutorials.md index 8388b98..2e7cc39 100644 --- a/docs/tutorials.md +++ b/docs/tutorials.md @@ -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 diff --git a/src/snippet.rs b/src/snippet.rs index bb19d82..dcd358f 100644 --- a/src/snippet.rs +++ b/src/snippet.rs @@ -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, diff --git a/tests/conftest.py b/tests/conftest.py index af64cb3..313fdba 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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