From 8779c09becfbdc06c09193a729de742a11fe8d99 Mon Sep 17 00:00:00 2001 From: XnpioChV Date: Tue, 6 Aug 2024 22:41:46 -0500 Subject: [PATCH 1/2] feat: Problem types added as filterable attribute --- openedx/core/djangoapps/content/search/api.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openedx/core/djangoapps/content/search/api.py b/openedx/core/djangoapps/content/search/api.py index 9473dabbe427..2d69ebf5911c 100644 --- a/openedx/core/djangoapps/content/search/api.py +++ b/openedx/core/djangoapps/content/search/api.py @@ -323,6 +323,7 @@ def rebuild_index(status_cb: Callable[[str], None] | None = None) -> None: Fields.type, Fields.access_id, Fields.last_published, + Fields.content + ".problem_types", ]) # Mark which attributes are used for keyword search, in order of importance: client.index(temp_index_name).update_searchable_attributes([ From 4dd2b95fbe3ba2a11d166fb2e02438de3944d58b Mon Sep 17 00:00:00 2001 From: XnpioChV Date: Fri, 23 Aug 2024 18:19:51 -0500 Subject: [PATCH 2/2] refactor: Add problem_types in Fields class --- openedx/core/djangoapps/content/search/api.py | 2 +- openedx/core/djangoapps/content/search/documents.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/openedx/core/djangoapps/content/search/api.py b/openedx/core/djangoapps/content/search/api.py index 4b36ba74bdf5..f59b9de37132 100644 --- a/openedx/core/djangoapps/content/search/api.py +++ b/openedx/core/djangoapps/content/search/api.py @@ -323,7 +323,7 @@ def rebuild_index(status_cb: Callable[[str], None] | None = None) -> None: Fields.type, Fields.access_id, Fields.last_published, - Fields.content + ".problem_types", + Fields.content + "." + Fields.problem_types, ]) # Mark which attributes are used for keyword search, in order of importance: client.index(temp_index_name).update_searchable_attributes([ diff --git a/openedx/core/djangoapps/content/search/documents.py b/openedx/core/djangoapps/content/search/documents.py index 032023f97c60..57720e54d05e 100644 --- a/openedx/core/djangoapps/content/search/documents.py +++ b/openedx/core/djangoapps/content/search/documents.py @@ -31,6 +31,7 @@ class Fields: created = "created" last_published = "last_published" block_type = "block_type" + problem_types = "problem_types" context_key = "context_key" org = "org" access_id = "access_id" # .models.SearchAccess.id