Boolean operators in search
For better multi-field filtering, boolean operators are needed.
At the moment, multi-field searches assume AND since django-filter
does not standardly implement other boolean operators for multi-term searches.
For reference, see this issue: https://github.com/carltongibson/django-filter/issues/1134
Approach:
- define a new viewset base class which overrides
get_queryset
ofrest_framework.viewsets.ModelViewSet
to allow per-search-field boolean operator specification; - by default, get the queryset by assuming OR composition (using Q to combine the queries) so that default multi-field queries work as expected;
- rewrite the frontend components to use the new querying format.
Possible solution: use django-rest-framework-filters
https://github.com/philipn/django-rest-framework-filters#complex-operations