diff --git a/modules/files/lib.py b/modules/files/lib.py index 171a9aad..4a215094 100644 --- a/modules/files/lib.py +++ b/modules/files/lib.py @@ -157,7 +157,6 @@ def search(search_str: str, limit: int, offset: int): SELECT id, ts_rank_cd(textsearch, websearch_to_tsquery(%(search_str)s)), COUNT(*) OVER() AS total FROM file WHERE textsearch @@ websearch_to_tsquery(%(search_str)s) - ORDER BY 1, 2 OFFSET %(offset)s LIMIT %(limit)s ''' params = dict(search_str=search_str, offset=offset, limit=limit) diff --git a/modules/files/test/test_api.py b/modules/files/test/test_api.py index 3931282b..84be4ed8 100644 --- a/modules/files/test/test_api.py +++ b/modules/files/test/test_api.py @@ -137,7 +137,7 @@ def test_files_search(test_session, test_client, make_files_structure): 'foo_is_the_name.txt', 'archives/bar.txt', 'baz.mp4', - 'baz two.mp4' + 'baz baz two.mp4' ] foo, bar, baz, baz2 = make_files_structure(files) foo.write_text('foo contents') @@ -152,8 +152,8 @@ def test_files_search(test_session, test_client, make_files_structure): do_search(test_client, 'foo', 1, [dict(path='foo_is_the_name.txt', mimetype='text/plain', size=12)]) do_search(test_client, 'bar', 1, [dict(path='archives/bar.txt', mimetype='text/plain', size=16)]) do_search(test_client, 'baz', 2, [ - dict(path='baz two.mp4', mimetype='video/mp4', size=1055736), + dict(path='baz baz two.mp4', mimetype='video/mp4', size=1055736), dict(path='baz.mp4', mimetype='video/mp4', size=1055736), ]) - do_search(test_client, 'two', 1, [dict(path='baz two.mp4', mimetype='video/mp4', size=1055736)]) + do_search(test_client, 'two', 1, [dict(path='baz baz two.mp4', mimetype='video/mp4', size=1055736)]) do_search(test_client, 'nothing', 0, [])