Not searching URL to speed up search query.

This commit is contained in:
Roland 2024-06-17 14:47:48 -06:00
parent bd431165e5
commit 1fbfb990f1
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
2 changed files with 3 additions and 2 deletions

View file

@ -731,8 +731,8 @@ def search_files(search_str: str, limit: int, offset: int, mimetypes: List[str]
joins = []
if search_str:
# Search by textsearch, and by matching url.
wheres.append("(textsearch @@ websearch_to_tsquery(%(search_str)s) OR fg.url ILIKE %(url_search_str)s)")
# Search by textsearch column.
wheres.append('textsearch @@ websearch_to_tsquery(%(search_str)s)')
selects.append('ts_rank(textsearch, websearch_to_tsquery(%(search_str)s))')
order_by = '2 DESC'

View file

@ -68,6 +68,7 @@ class FileGroup(ModelHelper, Base):
id: int = Column(BigInteger, primary_key=True)
author = Column(String) # name of the author, maybe even a URL
censored = Column(Boolean) # the file is no longer available for download
data = Column(FancyJSON) # populated by the modeler
download_datetime = Column(TZDateTime) # the date WROLPi downloaded this file.
files = Column(FancyJSON, nullable=False) # populated during discovery