Ordering results by columns.

This commit is contained in:
Roland 2022-03-09 15:51:24 -07:00
parent d0de92ef7e
commit 984aa04f0a
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
2 changed files with 2 additions and 1 deletions

View file

@ -157,6 +157,7 @@ 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 2, 1
OFFSET %(offset)s LIMIT %(limit)s
'''
params = dict(search_str=search_str, offset=offset, limit=limit)