Sphinx returns results as a dictionary. For example, the sequence of resulted IDs is [3,1,5,2,4] ordered by sphinx field weights. When passing them to a table object as a QuerySet I get table with objects sorted by IDs like [1,2,3,4,5]. How to preserve the right order of items in a queryset?
result = c.Query(q, 'db')
ids = [obj['id'] for obj in result['matches']]
queryset = Model.objects.filter(id__in=ids)
table = Table(queryset)
I can get rid of using tables at all, but it takes too long to execute something like
objects = [Model.objects.get(pk=obj['id']) for obj in result['matches']]
How it can be optimised?