Open
Description
Questions
Is there a way to override filter_queryset
in FilteringFilterBackend
without having to copy all the code to the inheriting class?
I want to add support for the match_phrase
operator but because the conditional defaults to the term
filter like in here:
# `term` filter lookup. This is default if no `default_lookup`
# option has been given or explicit lookup provided.
else:
queryset = self.apply_filter_term(queryset,
options,
value)
I end up with a query like this which doesn't work:
query":{"bool":{"filter":[{"term":{"name":"running"}}],"must":[{"match_phrase":{"name.trigram":"running"}}]}}
My apply
method is as follows:
return self.apply_query(
queryset=queryset,
options=options,
args=[Q("match_phrase", **{"{}.trigram".format(options['field']): value})]
)
Thanks.
-Selim