Hi all,

I'm using SolrPy to integrate django with solr for searching (very 
simple to configure by the way, highly recommend it). But I have a 
problem that I'm wonder if there's an elegant solution for either at the 
Django template or Python level (I can solve the problem in a messy way, 
but I like simple).

Basically, solr gives me a list of Ids which I then use as part of an 
'in' subquery to get all the objects from the db in one query. The 
problem is that SQL doesn't return the objects in the order of the 
provided list (which is to be expected). But now I have a queryset of 
objects which are in the wrong order.

So I have two lists, the list of actual objects in an effectively random 
order and a list of Ids in the correct order. I am wondering if there is 
a simple (both in lines-of-code and algorithmic complexity) way of 
reordering my list of objects with respect to the list of Ids. I know 
Django templates have reorder functionality, but that just sorts by a 
property, what I'm looking for is a bit more complex. Is there anything 
at the Python level I should be using?

Thanks,

- Andrew Ingram

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to