From 272bfba95dcec0d2dbdf5fcb2a8032417f62ada8 Mon Sep 17 00:00:00 2001 From: Bertrand Bordage Date: Wed, 18 Oct 2017 21:16:40 +0100 Subject: [PATCH] Fixes a QuerySet. --- wagtail/contrib/postgres_search/backend.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wagtail/contrib/postgres_search/backend.py b/wagtail/contrib/postgres_search/backend.py index a824a5ef66..30b14317a1 100644 --- a/wagtail/contrib/postgres_search/backend.py +++ b/wagtail/contrib/postgres_search/backend.py @@ -168,10 +168,10 @@ class Index(object): obj._object_id = force_text(obj.pk) obj._body_ = self.prepare_body(obj) connection = connections[self.db_alias] - # if connection.pg_version >= 90500: # PostgreSQL >= 9.5 - # self.add_items_upsert(connection, content_type_pk, objs, config) - # else: - self.add_items_update_then_create(content_type_pk, objs, config) + if connection.pg_version >= 90500: # PostgreSQL >= 9.5 + self.add_items_upsert(connection, content_type_pk, objs, config) + else: + self.add_items_update_then_create(content_type_pk, objs, config) def __str__(self): return self.name @@ -331,7 +331,7 @@ class PostgresSearchBackend(BaseSearchBackend): self.get_index_for_object(obj_list[0]).add_items(model, obj_list) def delete(self, obj): - obj.index_entries.delete() + obj.index_entries.all().delete() SearchBackend = PostgresSearchBackend