Skip to content

Commit

Permalink
fix for missing search_facets_limits
Browse files Browse the repository at this point in the history
  • Loading branch information
tino097 committed Oct 10, 2017
1 parent 0e412b8 commit eb04958
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions ckan/lib/helpers.py
Expand Up @@ -960,11 +960,12 @@ def get_facet_items_dict(facet, limit=None, exclude_active=False):
facets.append(dict(active=True, **facet_item))
# Sort descendingly by count and ascendingly by case-sensitive display name
facets.sort(key=lambda it: (-it['count'], it['display_name'].lower()))
if c.search_facets_limits and limit is None:
limit = c.search_facets_limits.get(facet)
# zero treated as infinite for hysterical raisins
if limit is not None and limit > 0:
return facets[:limit]
if hasattr(c, 'search_facets_limits'):
if c.search_facets_limits and limit is None:
limit = c.search_facets_limits.get(facet)
# zero treated as infinite for hysterical raisins
if limit is not None and limit > 0:
return facets[:limit]
return facets


Expand Down

0 comments on commit eb04958

Please sign in to comment.