From 1fbfb990f1a0506770534384f843a1aa422c0ef0 Mon Sep 17 00:00:00 2001 From: Roland Date: Mon, 17 Jun 2024 14:47:48 -0600 Subject: [PATCH] Not searching URL to speed up search query. --- wrolpi/files/lib.py | 4 ++-- wrolpi/files/models.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/wrolpi/files/lib.py b/wrolpi/files/lib.py index e20eef62..e2683263 100644 --- a/wrolpi/files/lib.py +++ b/wrolpi/files/lib.py @@ -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' diff --git a/wrolpi/files/models.py b/wrolpi/files/models.py index cfadd2e7..4f5563ec 100644 --- a/wrolpi/files/models.py +++ b/wrolpi/files/models.py @@ -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