django-haystack ordering - How do I handle this?

Posted by Bartek on Stack Overflow See other posts from Stack Overflow or by Bartek
Published on 2010-06-08T17:49:06Z Indexed on 2010/06/08 17:52 UTC
Read the original article Hit count: 342

Filed under:
|
|

Hi there,

I'm using django-haystack for a search page on my site. I'm basically done, but not quite happy with the ordering and not quite sure how haystack decides how to order everything.

I know I can over-ride the SearchQuerySet by using order_by but that over-rides it entirely. Let's say I want to force the search to order by in stock (BooleanField), so that the products that are in stock show up on top, but then do everything else as it normally would. How do I do that?

I tried doing order_by('-in_stock', 'content') figure content was what it used by default but it produces very different results from if I just leave it to do its own ordering.

Thanks for any input on this matter!

© Stack Overflow or respective owner

Related posts about django

Related posts about search