Commit 01347dfc authored by fred's avatar fred
Browse files

search: harden

parent 7343d670
......@@ -142,9 +142,11 @@ class SearchView(FacetedSearchView):
context['selected_tags'] = [
x.split(':', 1)[1] for x in self.request.GET.getlist('selected_facets')
if x.startswith('tags_exact')]
if 'categories' in context['facets'].get('fields', []):
context['facets']['fields']['categories'] = [x for x in
context['facets']['fields']['categories'] if x[1] > 0]
context['facets']['fields']['categories'].sort()
if 'tags' in context['facets'].get('fields', []):
context['facets']['fields']['tags'] = [x for x in
context['facets']['fields']['tags'] if x[1] > 0]
return context
......@@ -185,9 +187,11 @@ class ListenArchivesView(FacetedSearchView):
context['selected_tags'] = [
x.split(':', 1)[1] for x in self.request.GET.getlist('selected_facets')
if x.startswith('tags_exact')]
if 'categories' in context['facets'].get('fields', []):
context['facets']['fields']['categories'] = [x for x in
context['facets']['fields']['categories'] if x[1] > 0]
context['facets']['fields']['categories'].sort()
if 'tags' in context['facets'].get('fields', []):
context['facets']['fields']['tags'] = [x for x in
context['facets']['fields']['tags'] if x[1] > 0]
return context
......@@ -223,9 +227,11 @@ class NewsArchivesView(FacetedSearchView):
context['selected_tags'] = [
x.split(':', 1)[1] for x in self.request.GET.getlist('selected_facets')
if x.startswith('tags_exact')]
if 'news_categories' in context['facets'].get('fields', []):
context['facets']['fields']['news_categories'] = [x for x in
context['facets']['fields']['news_categories'] if x[1] > 0]
context['facets']['fields']['news_categories'].sort()
if 'tags' in context['facets'].get('fields', []):
context['facets']['fields']['tags'] = [x for x in
context['facets']['fields']['tags'] if x[1] > 0]
return context
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment