Skip to content

Commit

Permalink
Merge pull request #10 from DirectEmployers/prevent-group-search-error
Browse files Browse the repository at this point in the history
Prevent the errors caused by empty results [PD-513]
  • Loading branch information
mklauber committed Oct 22, 2014
2 parents 7090c01 + fb33724 commit 1b78ebb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions saved_search/groupsearch.py
Expand Up @@ -163,9 +163,12 @@ def search(self, query_string, sort_by=None, start_offset=0, end_offset=None,
e)
raw_results = [EmptyResults()]

return [self._process_results(res, highlight=highlight,
result_class=result_class)
for res in raw_results.grouped.iteritems()]
if hasattr(raw_results, 'grouped'):
return [self._process_results(res, highlight=highlight,
result_class=result_class)
for res in raw_results.grouped.iteritems()]
else:
return []

def _process_results(self, raw_results, highlight=False, result_class=None):
from haystack import connections
Expand Down

0 comments on commit 1b78ebb

Please sign in to comment.