Files can be searched.

This commit is contained in:
Roland 2022-02-01 14:11:14 -07:00
parent a5e8ef16b6
commit 643c86e9a4
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
7 changed files with 187 additions and 87 deletions

View file

@ -126,6 +126,9 @@ def refresh_files():
def search(search_str: str, limit: int, offset: int):
"""
Search the "title" of each file. The title is the words in the file's stem.
"""
with get_db_curs() as curs:
stmt = '''
SELECT id, ts_rank_cd(textsearch, websearch_to_tsquery(%(search_str)s)), COUNT(*) OVER() AS total