Skip to content

Commit

Permalink
fix: circuvent meilisearch bug
Browse files Browse the repository at this point in the history
  • Loading branch information
rpenido committed Oct 10, 2024
1 parent e553ec0 commit ccb2c54
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions openedx/core/djangoapps/content/search/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,13 @@ def _collections_for_content_object(object_id: UsageKey | LearningContextKey) ->
}
"""
result = {
Fields.collections: {
Fields.collections_display_name: [],
Fields.collections_key: [],
}
}

# Gather the collections associated with this object
collections = None
try:
Expand All @@ -279,14 +286,8 @@ def _collections_for_content_object(object_id: UsageKey | LearningContextKey) ->
log.warning(f"No component found for {object_id}")

if not collections:
return {Fields.collections: {}}
return result

result = {
Fields.collections: {
Fields.collections_display_name: [],
Fields.collections_key: [],
}
}
for collection in collections:
result[Fields.collections][Fields.collections_display_name].append(collection.title)
result[Fields.collections][Fields.collections_key].append(collection.key)
Expand Down

0 comments on commit ccb2c54

Please sign in to comment.