feat: add groups to search vector
Some checks reported errors
continuous-integration/drone/push Build was killed

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Simon 2026-02-18 12:47:23 +01:00
parent 3f07de1276
commit f6575319f7
Signed by: simon
GPG key ID: 40E7A58C4AA1EDB2
6 changed files with 878 additions and 5 deletions

View file

@ -233,16 +233,23 @@ Settings (1) → MembershipFeeType (0..1)
## Full-Text Search
### Implementation
- **Trigger:** `members_search_vector_trigger()`
- **Function:** Automatically updates `search_vector` on INSERT/UPDATE
- **Trigger:** `members_search_vector_trigger()` on `members` (INSERT/UPDATE)
- **Trigger:** `update_member_search_vector_from_member_groups()` on `member_groups` (INSERT/UPDATE/DELETE)
- **Function:** Automatically updates `search_vector` on member and member_groups changes
- **Index Type:** GIN (Generalized Inverted Index)
### Weighted Fields
- **Weight A (highest):** first_name, last_name
- **Weight B:** email, notes
- **Weight B:** email, notes, group names (from member_groups → groups)
- **Weight C:** city, street, house_number, postal_code, custom_field_values
- **Weight D (lowest):** join_date, exit_date
### Group Names in Search
Group names are included in the member search vector so that searching for a group name (e.g. "Vorstand") finds all members in that group:
- Group names are aggregated from `member_groups` joined with `groups` and receive weight 'B'
- The trigger `update_member_search_vector_on_member_groups_change` runs on INSERT/UPDATE/DELETE on `member_groups` and refreshes the affected member's `search_vector`
- See migration `20260217120000_add_group_names_to_member_search_vector.exs` (Issue #375)
### Custom Field Values in Search
Custom field values are automatically included in the search vector:
- All custom field values (string, integer, boolean, date, email) are aggregated and added to the search vector