feat(search): school type groups and a faith filter #170

Merged
tudor merged 9 commits from feat/school-type-groups-faith into main 2026-10-02 14:05:43 +00:00
3 changed files with 14 additions and 9 deletions
Showing only changes of commit 214c80663e - Show all commits

No files matched your search

@@ -131,13 +131,20 @@ names. The names come from the same dictionaries, so the lookup is exact.
### `/api/schools`
- `school_type`: if the value is a type group key, filter on
`school_type_group`. Otherwise filter on the raw label exactly as today, so
an old `?school_type=Community+school` link keeps working.
- `faith` (new, optional, `max_length=40`, sanitised like the others): filter to
rows whose `faith_groups` contains the key. An unknown key returns no
schools rather than being ignored, so a typo does not silently show
everything.
Both filters work on the name columns at request time. `_names_in_group`
collects the distinct `school_type` or `religious_denomination` names the
group accepts, once per distinct name rather than per row, and the rows are
kept with `isin`. No group column is stored.
- `school_type`: if the value is a type group key (any case), keep the rows
whose `school_type` name `type_group_for` puts in that group. Otherwise
filter on the raw label exactly as today, so an old
`?school_type=Community+school` link keeps working.
- `faith` (new, optional, `max_length=40`, sanitised like the others): keep the
rows whose `religious_denomination` name `faith_groups_for` puts in that
faith (any case); for `none`, rows with a missing name too. An unknown key
returns no schools rather than being ignored, so a typo does not silently
show everything.
### `/api/filters`
@@ -135,4 +135,3 @@ describe('a URL value the options do not spell the same way', () => {
expect(screen.getByRole('combobox', { name: 'Faith' })).toHaveValue('roman_catholic');
});
});
@@ -176,4 +176,3 @@ describe('the results list filter chips', () => {
expect(chips).not.toHaveTextContent(/\bcouncil\b(?!-run)/);
});
});