From 79aab1e15e8a6bf5594f09bd1962a172955e8b39 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 31 Mar 2024 14:49:57 +0100 Subject: [PATCH] Only index plain content --- yamdl_playground/core/apps.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/yamdl_playground/core/apps.py b/yamdl_playground/core/apps.py index 9422d6b..3c72d13 100644 --- a/yamdl_playground/core/apps.py +++ b/yamdl_playground/core/apps.py @@ -2,6 +2,7 @@ from django.apps import AppConfig from django.db import connections from django.db.models.signals import post_save import warnings +from django.utils.html import strip_tags class CoreConfig(AppConfig): @@ -28,4 +29,4 @@ class CoreConfig(AppConfig): if not created: return 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])