toastdriven/django-haystack — pull request #629 by tauberer (2012-08-27 21:47:15+00:00)
Title: accept facet options (e.g. limit, mincount) & clone more_like_this fields

Hey there. Thanks for your great work on Haystack.

I've been using it behind my faceted search through bills in the US Congress at http://www.govtrack.us/congress/bills/browse. The facet counts on my site have been quoted in The Washington Post and other newspapers, so Haystack has been a part of advancing national dialog. :)

Am hoping you'll find these changes useful:

1) Revised .facet(...) to optionally accept the parameters that Solr uses, like limit and mincount. Solr's defaults are pretty odd --- not actually returning all of the facets, and returning facets with zero counts. Being able to control these options is really useful (to me at least).

I tried to do this in a very generic way so that it could be applied to other backends easily.

2) Fixed SearchQuery to clone the more_like_this fields so that .more_like_this(...).filter(...) works, which Solr actually can handle without any problems.

Ignore the commit in here about some update_index problem in Django 1.4.