fpdcc / document-search

Search and management interface for spatial documents at the Forest Preserves of Cook County.
2 stars 0 forks source link

filter by OR instead of AND #93

Closed smcalilly closed 1 year ago

smcalilly commented 1 year ago

Overview

Demo

or-search

Notes

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.

Relevant django-haystack documentation about complex queries.

Testing Instructions