Pretty much the same flavor as: Django get a QuerySet from array of id's in specific order. I tried https://stackoverflow.com/a/37648265/4810639
But my list of ids is huge (> 50000) and both qs = Foo.objects.filter(id__in=id_list)
and qs = qs.order_by(preserved)
buckle under the strain.
Note: I need a queryset due to the specific django method I'm overriding so anything returning a list won't work.
EDIT: In response to the comments I'm specifically overriding the get_search_results()
in the admin. My search engine returns the id
of the model(s) that match the query. But get_search_results()
needs to return a queryset. Hence the large list of id
's.