Browse Source

Remove period chars from search query for multilevel tags

Tags are stored in the search index as space-separated strings
with the periods removed. Searches for "parent.child" tags
were failing because of the period.

Removing period is okay for now because URL domains are not
currently indexed for search.
merge-requests/117/merge
Andrew Shu 4 years ago
committed by Deimos
parent
commit
33f551fb21
  1. 5
      tildes/tildes/models/topic/topic_query.py

5
tildes/tildes/models/topic/topic_query.py

@ -216,6 +216,11 @@ class TopicQuery(PaginatedQuery):
def search(self, query: str) -> "TopicQuery":
"""Restrict the topics to ones that match a search query (generative)."""
# Replace "." with space, since tags are stored as space-separated strings
# in the search index.
# URL domains are not indexed, so removing "." is okay for now.
query = query.replace(".", " ")
return self.filter(Topic.search_tsv.op("@@")(func.websearch_to_tsquery(query)))
def only_bookmarked(self) -> "TopicQuery":

Loading…
Cancel
Save