Conversation
Regarding query behaviour via
Tricky. The original search interface was designed to be 'pretty' (e.g. URLs like
Let's not change the API parameter name if possible. Public bodies can have multiple categories and it should be possible to filter by multiple categories, so the plural makes sense.
I think this is mainly because exposing a user interface for these search parameters does not serve a common use cases for web browser users, but for API users it's helpful (I built the feature because I needed it). If we can have the same search/filter machinery for API and UI while keeping the UI simple and the API stable, let's do it. |
Search is currently handled differently in regular views and API views, which leads to inconsistent search results depending on whether a search is performed via the search form or through the API.
This is especially the case for
PublicBody(see https://github.com/fragdenstaat/issues/issues/293). In the API view,get_searchquerysetis overridden with a custom search and filtering configuration. As a result, recent changes to the search analyzers are not applied there. UsingPublicBodyFilterSetinstead, as in the view, could resolve this.However, I noticed several differences between
PublicBodysearch in views and in the API (which is also why the tests I added are currently failing):multi_matchsearch, while the rest of the application appears to usesimple_query_string.PublicBodyFilterSetuses slugs (which seems to be consistent with other API endpoints, e.g. forFoiRequest).categoriesin the API butcategoryinPublicBodyFilterSet.regionsandregions_kindexist in the API, but not inPublicBodyFilterSet.I’m unsure how to resolve these differences without breaking the API, and which parts are still intentional vs. legacy behaviour.
@stefanw Could you take a look?