From 940622a638ec59ff534b67ab79b97be1f17ca1cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mois=C3=A9s=20Gonz=C3=A1lez?= Date: Tue, 26 Nov 2024 16:36:57 -0400 Subject: [PATCH] fix: include catalog_visibility filter in courseware_content The catalog_visibility filter is passed to the courseware_content index when performing a search using the legacy student dashboard view. If not included an error like follows is raised: MeilisearchApiError. Error code: invalid_search_filter. Error message: Attribute `catalog_visibility` is not filterable --- search/meilisearch.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/search/meilisearch.py b/search/meilisearch.py index 9e09e426..9ee75015 100644 --- a/search/meilisearch.py +++ b/search/meilisearch.py @@ -97,13 +97,14 @@ "language", # aggregate by language, mode, org "modes", "org", - "catalog_visibility", # exclude visibility="none" + "catalog_visibility", # used if not settings.SEARCH_SKIP_SHOW_IN_CATALOG_FILTERING "enrollment_end", # include only enrollable courses ], getattr(settings, "COURSEWARE_CONTENT_INDEX_NAME", "courseware_content"): [ PRIMARY_KEY_FIELD_NAME, # exclude some specific documents based on ID "course", # search courseware content by course "org", # used during indexing + "catalog_visibility", # used if not settings.SEARCH_SKIP_SHOW_IN_CATALOG_FILTERING "start_date", # limit search to started courses ], }