diff --git a/openedx/core/djangoapps/content/search/documents.py b/openedx/core/djangoapps/content/search/documents.py index 245d9db8af1..40fe4529272 100644 --- a/openedx/core/djangoapps/content/search/documents.py +++ b/openedx/core/djangoapps/content/search/documents.py @@ -401,8 +401,6 @@ def searchable_doc_for_library_block(xblock_metadata: lib_api.LibraryXBlockMetad # Add the breadcrumbs. In v2 libraries, the library itself is not a "parent" of the XBlocks so we add it here: doc[Fields.breadcrumbs] = [{"display_name": library_name}] - # Add collections data to index if this block is part of any collection - doc.update(_collections_for_content_object(xblock_metadata.usage_key)) return doc diff --git a/openedx/core/djangoapps/content_libraries/api.py b/openedx/core/djangoapps/content_libraries/api.py index 9f8d81401b4..c51c707fc47 100644 --- a/openedx/core/djangoapps/content_libraries/api.py +++ b/openedx/core/djangoapps/content_libraries/api.py @@ -1151,6 +1151,14 @@ def restore_library_block(usage_key): ) ) + # Add tags and collections back to index + CONTENT_OBJECT_ASSOCIATIONS_CHANGED.send_event( + content_object=ContentObjectChangedData( + object_id=str(usage_key), + changes=["collections", "tags"], + ), + ) + # For each collection, trigger LIBRARY_COLLECTION_UPDATED signal and set background=True to trigger # collection indexing asynchronously. #