improve validation on text indexing, for search (#294)

pull/299/head
Markos Gogoulos 2021-10-01 17:49:41 +03:00 zatwierdzone przez GitHub
rodzic 28031f07e5
commit f974d78270
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 4 dodań i 2 usunięć

Wyświetl plik

@ -395,11 +395,11 @@ class Media(models.Model):
b_tags = " ".join([tag.title.replace("-", " ") for tag in self.tags.all()])
items = [
helpers.clean_query(self.title),
self.title,
self.user.username,
self.user.email,
self.user.name,
helpers.clean_query(self.description),
self.description,
a_tags,
b_tags,
]
@ -407,6 +407,8 @@ class Media(models.Model):
text = " ".join(items)
text = " ".join([token for token in text.lower().split(" ") if token not in STOP_WORDS])
text = helpers.clean_query(text)
sql_code = """
UPDATE {db_table} SET search = to_tsvector(
'{config}', '{text}'