From bb17328f2d924c6699146d15f126cec8c3e2432d Mon Sep 17 00:00:00 2001 From: Erlend Simonsen Date: Thu, 8 Aug 2024 12:36:04 +0200 Subject: [PATCH] Expose SnippetGenerator.set_max_num_chars() so changing the default is possible (#323) Co-authored-by: Erlend Simonsen --- src/snippet.rs | 4 ++++ tantivy/tantivy.pyi | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/snippet.rs b/src/snippet.rs index 7bfe281..f8de416 100644 --- a/src/snippet.rs +++ b/src/snippet.rs @@ -80,4 +80,8 @@ impl SnippetGenerator { let result = self.inner.snippet(&text); Snippet { inner: result } } + + pub fn set_max_num_chars(&mut self, max_num_chars: usize) { + self.inner.set_max_num_chars(max_num_chars); + } } diff --git a/tantivy/tantivy.pyi b/tantivy/tantivy.pyi index e77180f..0120c32 100644 --- a/tantivy/tantivy.pyi +++ b/tantivy/tantivy.pyi @@ -433,3 +433,6 @@ class SnippetGenerator: def snippet_from_doc(self, doc: Document) -> Snippet: pass + + def set_max_num_chars(self, max_num_chars: int) -> None: + pass \ No newline at end of file