updated tests for offset query

master
sourcepirate 2020-09-06 18:26:17 +08:00 committed by Damir Jelić
parent 42d29b5e94
commit 20989628e4
2 changed files with 8 additions and 2 deletions

View File

@ -94,7 +94,7 @@ impl Searcher {
/// should be ordered by. The field must be declared as a fast field /// should be ordered by. The field must be declared as a fast field
/// when building the schema. Note, this only works for unsigned /// when building the schema. Note, this only works for unsigned
/// fields. /// fields.
/// offset (Field, optional): The offset from which the results have /// offset (Field, optional): The offset from which the results have
/// to be returned. /// to be returned.
/// ///
/// Returns `SearchResult` object. /// Returns `SearchResult` object.
@ -108,7 +108,7 @@ impl Searcher {
limit: usize, limit: usize,
count: bool, count: bool,
order_by_field: Option<&str>, order_by_field: Option<&str>,
offset: usize offset: usize,
) -> PyResult<SearchResult> { ) -> PyResult<SearchResult> {
let mut multicollector = MultiCollector::new(); let mut multicollector = MultiCollector::new();

View File

@ -163,7 +163,13 @@ class TestClass(object):
query = index.parse_query("test") query = index.parse_query("test")
searcher = index.searcher() 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") result = searcher.search(query, 10, order_by_field="order")
assert len(result.hits) == 3 assert len(result.hits) == 3