From 6a8a202565759ec3a07401271ac5cafb37854cf8 Mon Sep 17 00:00:00 2001 From: Giovanni Allegri Date: Mon, 30 Oct 2023 10:05:08 +0100 Subject: [PATCH] thesaurus topics should only return its own keys (#11644) --- geonode/facets/providers/thesaurus.py | 2 +- geonode/facets/tests.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/geonode/facets/providers/thesaurus.py b/geonode/facets/providers/thesaurus.py index 047ac9b82ea..cec04f7ad16 100644 --- a/geonode/facets/providers/thesaurus.py +++ b/geonode/facets/providers/thesaurus.py @@ -111,7 +111,7 @@ def get_facet_items( def get_topics(self, keys: list, lang="en", **kwargs) -> list: q = ( - ThesaurusKeyword.objects.filter(id__in=keys) + ThesaurusKeyword.objects.filter(id__in=keys, thesaurus__identifier=self.name) .values("id", "alt_label") .annotate( localized_label=Subquery( diff --git a/geonode/facets/tests.py b/geonode/facets/tests.py index 8b4812a110f..22a9e18e929 100644 --- a/geonode/facets/tests.py +++ b/geonode/facets/tests.py @@ -498,6 +498,7 @@ def t(tk): {regfilter: "R0", t0filter: t("0_1"), "key": [t("1_1"), t("1_0")]}, {t("1_0"): None, t("1_1"): None}, ), + ("t_1", {"key": [t("0_1")]}, {}), # regions (regname, {t1filter: t("1_1")}, {"R1": 1}), (regname, {t1filter: t("1_1"), "key": ["R0", "R1"]}, {"R1": 1, "R0": None}),