diff --git a/apps/contrib/elasticsearch.py b/apps/contrib/elasticsearch.py index 133f998b..9420684a 100644 --- a/apps/contrib/elasticsearch.py +++ b/apps/contrib/elasticsearch.py @@ -40,6 +40,8 @@ def _get_results_from_hits(self, hits): break for obj in self.query_compiler.queryset.filter(pk__in=pks): + if not obj.live or obj.get_view_restrictions().exists(): + continue results[str(obj.pk)] = obj if self._score_field: diff --git a/changelog/_1113.md b/changelog/_1113.md new file mode 100644 index 00000000..0f1555ab --- /dev/null +++ b/changelog/_1113.md @@ -0,0 +1,3 @@ +### Changed + +- Pages which are not published or password protected are excluded from the search results (#851, #877)