Commit a137c932 authored by Tanner Prestegard's avatar Tanner Prestegard Committed by GraceDB
Browse files

Properly apply label filters to superevent searches from the API

parent 870b192f
......@@ -6,6 +6,7 @@ from django.http import HttpResponseBadRequest
from rest_framework import filters, exceptions
from search.query.labels import filter_for_labels
from search.query.superevents import parseSupereventQuery
# Set up logger
......@@ -35,10 +36,12 @@ class SupereventSearchFilter(filters.SearchFilter):
# Do filtering
filter_params = parseSupereventQuery(query)
qs = queryset.filter(filter_params)
qs = filter_for_labels(qs, query).distinct()
except ParseException as e:
raise exceptions.ParseError('Invalid query')
return queryset.filter(filter_params)
return qs
class SupereventOrderingFilter(filters.OrderingFilter):
Markdown is supported
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