Skip to content

Commit a325feb

Browse files
committed
Fix search bug when an empty list of objects_id was passed
This makes it so we're explicitly checking for one being passed so when an empty list is passed it fails.
1 parent 9006697 commit a325feb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

readthedocs/search/tasks.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ def index_objects_to_es(
1414
app_label, model_name, document_class, index_name=None, chunk=None, objects_id=None
1515
):
1616

17-
assert not (chunk and objects_id), "You can not pass both chunk and objects_id"
17+
assert not (chunk and objects_id), \
18+
"You can not pass both chunk and objects_id"
19+
assert (chunk or objects_id), \
20+
"You must pass a chunk or objects_id"
1821

1922
model = apps.get_model(app_label, model_name)
2023
document = _get_document(model=model, document_class=document_class)

0 commit comments

Comments
 (0)