Commit 33f551fb authored by Andrew Shu's avatar Andrew Shu Committed by Deimos

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.
parent 9531221b
......@@ -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":
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment