server/search: fix errors on negative page offsets
This commit is contained in:
parent
ba4df16499
commit
e4aa38f159
2 changed files with 6 additions and 1 deletions
|
@ -84,6 +84,10 @@ class Executor:
|
||||||
search_query = self.parser.parse(query_text)
|
search_query = self.parser.parse(query_text)
|
||||||
self.config.on_search_query_parsed(search_query)
|
self.config.on_search_query_parsed(search_query)
|
||||||
|
|
||||||
|
if offset < 0:
|
||||||
|
limit = max(0, limit + offset)
|
||||||
|
offset = 0
|
||||||
|
|
||||||
disable_eager_loads = False
|
disable_eager_loads = False
|
||||||
for token in search_query.sort_tokens:
|
for token in search_query.sort_tokens:
|
||||||
if token.name == 'random':
|
if token.name == 'random':
|
||||||
|
|
|
@ -155,7 +155,8 @@ def test_combining_tokens(
|
||||||
(0, 1, 2, ['u1']),
|
(0, 1, 2, ['u1']),
|
||||||
(1, 1, 2, ['u2']),
|
(1, 1, 2, ['u2']),
|
||||||
(2, 1, 2, []),
|
(2, 1, 2, []),
|
||||||
(-1, 1, 2, ['u1']),
|
(-1, 1, 2, []),
|
||||||
|
(-1, 2, 2, ['u1']),
|
||||||
(0, 2, 2, ['u1', 'u2']),
|
(0, 2, 2, ['u1', 'u2']),
|
||||||
(3, 1, 2, []),
|
(3, 1, 2, []),
|
||||||
(0, 0, 2, []),
|
(0, 0, 2, []),
|
||||||
|
|
Loading…
Reference in a new issue