diff --git a/openedx/core/djangoapps/content/search/api.py b/openedx/core/djangoapps/content/search/api.py index cc80d36cbd49..4262b8a7b13f 100644 --- a/openedx/core/djangoapps/content/search/api.py +++ b/openedx/core/djangoapps/content/search/api.py @@ -476,7 +476,8 @@ def delete_all_draft_docs_for_library(library_key: LibraryLocatorV2) -> None: # Delete all documents where last_published is null i.e. never published before. delete_filter = [ f'{Fields.context_key}="{library_key}"', - # inner arrays are connected by an OR + # This field should only be NULL or have a value, but we're also checking IS EMPTY just in case. + # Inner arrays are connected by an OR [f'{Fields.last_published} IS EMPTY', f'{Fields.last_published} IS NULL'], ]