toastdriven/django-haystack — pull request #925 by acdha (2014-01-26 20:07:12+00:00)
Title: Unify the run() method across backends

The Solr and ElasticSearch backends define `run()` in a manner which is very similar to the base class but there's at least one bug in the current approach: #888 had a regression where the kwargs are no longer passed into the query, causing the custom field list provided by `ValuesQuerySet` to be ignored.

https://github.com/toastdriven/django-haystack/blob/master/haystack/backends/__init__.py#L554-L566

https://github.com/toastdriven/django-haystack/blob/master/haystack/backends/solr_backend.py#L688-L698

https://github.com/toastdriven/django-haystack/blob/master/haystack/backends/elasticsearch_backend.py#L910-L918

Proposed fix:
1. Add a `pre_process_results` method which will run immediately after the `backend.search` call, allowing subclasses to view the full results and potentially even alter something like the results list before everything else sees it
2. Remove the `run()` method from the Solr and ES backends
3. Add a default `pre_process_results` implementation to Solr which extracts stats from the results