Skip to content

Commit

Permalink
fix: include collection data on indexing new library blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
navinkarkera committed Dec 12, 2024
1 parent df4a4f3 commit 1af60f0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion openedx/core/djangoapps/content/search/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,10 @@ def _collections_for_content_object(object_id: UsageKey | LearningContextKey) ->
If the object is in no collections, returns:
{
"collections": {},
"collections": {
"display_name": [],
"key": [],
},
}
"""
Expand Down Expand Up @@ -398,6 +401,8 @@ 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

Expand Down

0 comments on commit 1af60f0

Please sign in to comment.