From 1666df6ab0b7bae4a433e9d5bdcea07d878e1348 Mon Sep 17 00:00:00 2001 From: Samuel Allan Date: Thu, 28 Aug 2025 12:01:01 +0930 Subject: [PATCH 1/2] fix: override FORUM_SEARCH_BACKEND The Tutor forum plugin hardcodes FORUM_SEARCH_BACKEND to Meilisearch, so we need to override it here, otherwise the forum will continue to use Meilisearch. Private-ref: https://tasks.opencraft.com/browse/BB-9975 --- README.rst | 1 + tutor_typesense/patches/openedx-common-settings | 1 + 2 files changed, 2 insertions(+) diff --git a/README.rst b/README.rst index 4c81b15..caad045 100644 --- a/README.rst +++ b/README.rst @@ -76,6 +76,7 @@ This plugin provides the following settings to Open edX components for integrati - (common) ``TYPESENSE_ENABLED: bool = True`` - whether the Typesense backend is enabled - (common) ``TYPESENSE_COLLECTION_PREFIX: str = "the_configured_collection_prefix"`` - a prefix that the backend should use for all collections (the API key is scoped to this prefix) +- (common) ``FORUM_SEARCH_BACKEND = "forum.search.typesense.TypesenseBackend"`` - necessary to override Tutor's default forum search backend value pointing to Meilisearch - (cms, lms) ``TYPESENSE_URL: str = "http://typesense:8108"`` - the internal url for accessing the Typesense API - (cms, lms) ``TYPESENSE_PUBLIC_URL: str = "http://(depends on TYPESENSE_PUBLIC_HOST)"`` - the public url to the Typesense API (for user searches on the frontend) - (cms, lms) ``TYPESENSE_API_KEY: str = "the api key"`` - an api key for the Open edX backend to make updates to Typesense collections diff --git a/tutor_typesense/patches/openedx-common-settings b/tutor_typesense/patches/openedx-common-settings index 6ff8566..975aefa 100644 --- a/tutor_typesense/patches/openedx-common-settings +++ b/tutor_typesense/patches/openedx-common-settings @@ -1,2 +1,3 @@ TYPESENSE_ENABLED = True TYPESENSE_COLLECTION_PREFIX = "{{ TYPESENSE_COLLECTION_PREFIX }}" +FORUM_SEARCH_BACKEND = "forum.search.typesense.TypesenseBackend" From a19eb96d63aa204d3d1fea276290d04429fa23f1 Mon Sep 17 00:00:00 2001 From: Samuel Allan Date: Thu, 28 Aug 2025 12:02:33 +0930 Subject: [PATCH 2/2] fix: increase Typesense max-per-page server option The forum sets a constant search comment count of 1000 ( https://github.com/openedx/forum/blob/51ec507/forum/constants.py ), and the Elasticsearch and Meilisearch backends respect that. So to use this value for Typesense too, we need to increase the max-per-page server option. The default is 250 in Typesense. Private-ref: https://tasks.opencraft.com/browse/BB-9975 --- tutor_typesense/patches/k8s-deployments | 3 +++ tutor_typesense/patches/local-docker-compose-services | 2 ++ 2 files changed, 5 insertions(+) diff --git a/tutor_typesense/patches/k8s-deployments b/tutor_typesense/patches/k8s-deployments index d563f52..86fe3cd 100644 --- a/tutor_typesense/patches/k8s-deployments +++ b/tutor_typesense/patches/k8s-deployments @@ -24,6 +24,9 @@ spec: value: "{{ TYPESENSE_BOOTSTRAP_API_KEY }}" - name: TYPESENSE_DATA_DIR value: /typesense_data + # forum expects up to 1000 per page - https://github.com/openedx/forum/blob/master/forum/constants.py + - name: TYPESENSE_MAX_PER_PAGE + value: "1000" ports: - containerPort: 8108 volumeMounts: diff --git a/tutor_typesense/patches/local-docker-compose-services b/tutor_typesense/patches/local-docker-compose-services index cd6a2ac..47d4d4a 100644 --- a/tutor_typesense/patches/local-docker-compose-services +++ b/tutor_typesense/patches/local-docker-compose-services @@ -6,4 +6,6 @@ typesense: environment: TYPESENSE_API_KEY: "{{ TYPESENSE_BOOTSTRAP_API_KEY }}" TYPESENSE_DATA_DIR: "/typesense_data" + # forum expects up to 1000 per page - https://github.com/openedx/forum/blob/master/forum/constants.py + TYPESENSE_MAX_PER_PAGE: "1000" restart: unless-stopped