To achieve this, I changed the form inheritance and overrode the search method. The FacetedSearchForm uses the narrow SearchQuerySet function in the FacetedSearchForm's search method. This made it impossible to inherit from the FacetedSearchForm because it would always call the super().search() and then the narrow (and thus would narrow down search results aka return no search results).
I basically reimplemented the FacetedSearchForm class but allowed for OR queries instead of the narrow function. Inheriting directly from the SearchForm seems the simplest way to hook into the SearchForm's logic.
Overview
Demo
Notes
To achieve this, I changed the form inheritance and overrode the search method. The
FacetedSearchForm
uses thenarrow
SearchQuerySet function in theFacetedSearchForm
'ssearch
method. This made it impossible to inherit from theFacetedSearchForm
because it would always call thesuper().search()
and then thenarrow
(and thus would narrow down search results aka return no search results).I basically reimplemented the
FacetedSearchForm
class but allowed for OR queries instead of thenarrow
function. Inheriting directly from theSearchForm
seems the simplest way to hook into theSearchForm
's logic.Relevant django-haystack documentation about complex queries.
Testing Instructions