Skip to content

Conversation

@noeddl
Copy link
Contributor

@noeddl noeddl commented Feb 11, 2026

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_searchqueryset is overridden with a custom search and filtering configuration. As a result, recent changes to the search analyzers are not applied there. Using PublicBodyFilterSet instead, as in the view, could resolve this.

However, I noticed several differences between PublicBody search in views and in the API (which is also why the tests I added are currently failing):

  • The API uses multi_match search, while the rest of the application appears to use simple_query_string.
  • The API filters by IDs, whereas PublicBodyFilterSet uses slugs (which seems to be consistent with other API endpoints, e.g. for FoiRequest).
  • The category filter is named categories in the API but category in PublicBodyFilterSet.
  • Filters for regions and regions_kind exist in the API, but not in PublicBodyFilterSet.

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant