Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Sort Haystack SearchResults
from haystack.views import SearchView
class CustomSearch(SearchView):
def extra_context(self):
seg_results = {}
for result in self.results:
if not result.model_name in seg_results:
seg_results[result.model_name] = [result]
return {'sorted_results':seg_results}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment