1
Fork 0

Only index plain content

This commit is contained in:
Jake Howard 2024-03-31 14:49:57 +01:00
parent 7475d70c95
commit 79aab1e15e
Signed by: jake
GPG key ID: 57AFB45680EDD477

View file

@ -2,6 +2,7 @@ from django.apps import AppConfig
from django.db import connections from django.db import connections
from django.db.models.signals import post_save from django.db.models.signals import post_save
import warnings import warnings
from django.utils.html import strip_tags
class CoreConfig(AppConfig): class CoreConfig(AppConfig):
@ -28,4 +29,4 @@ class CoreConfig(AppConfig):
if not created: if not created:
return return
with connections["default"].cursor() as cursor: with connections["default"].cursor() as cursor:
cursor.execute("INSERT INTO search_index(body, rowid) VALUES (%s, %s)", [instance.content, instance.pk]) cursor.execute("INSERT INTO search_index(body, rowid) VALUES (%s, %s)", [strip_tags(instance.content), instance.pk])