From 20989628e480f1f9de0ac50e97f0769cdcbc2822 Mon Sep 17 00:00:00 2001 From: sourcepirate Date: Sun, 6 Sep 2020 18:26:17 +0800 Subject: [PATCH] updated tests for offset query --- src/searcher.rs | 4 ++-- tests/tantivy_test.py | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/searcher.rs b/src/searcher.rs index b0bbc5c..f408ef5 100644 --- a/src/searcher.rs +++ b/src/searcher.rs @@ -94,7 +94,7 @@ impl Searcher { /// should be ordered by. The field must be declared as a fast field /// when building the schema. Note, this only works for unsigned /// fields. - /// offset (Field, optional): The offset from which the results have + /// offset (Field, optional): The offset from which the results have /// to be returned. /// /// Returns `SearchResult` object. @@ -108,7 +108,7 @@ impl Searcher { limit: usize, count: bool, order_by_field: Option<&str>, - offset: usize + offset: usize, ) -> PyResult { let mut multicollector = MultiCollector::new(); diff --git a/tests/tantivy_test.py b/tests/tantivy_test.py index fc0ccc5..08b5b2c 100644 --- a/tests/tantivy_test.py +++ b/tests/tantivy_test.py @@ -163,7 +163,13 @@ class TestClass(object): query = index.parse_query("test") + searcher = index.searcher() + + result = searcher.search(query, 10, offset=2, order_by_field="order") + + assert len(result.hits) == 1 + result = searcher.search(query, 10, order_by_field="order") assert len(result.hits) == 3