Add schema-agnostic PostgreSQL full-text search layer#220
Conversation
…ries Signed-off-by: Arup Chauhan <[email protected]>
Signed-off-by: Arup Chauhan <[email protected]>
|
Hello everyone, This PR adds the database-side search implementation layer using PostgreSQL full-text search and Scope is the DB search foundation: request search, user search, organization search, schema-agnostic migration execution, and local validation against both Virginia and Ireland-style schema clones. Fuzzy search is limited to the MVP search entities and fields: requests, users, and organizations. It is not applied globally to every table. The production scripts are shared across schemas through This PR also includes DB-side authorization-aware filtering in the search functions. QA/RDS validation is still pending because it requires QA database access, but the local validation runners pass for both schemas. |
Signed-off-by: Arup Chauhan <[email protected]>
1a667f6 to
10d0f1c
Compare
|
Hello everyone, adding the current update here for review: The DB level Phase 1 search implementation is now in place based on the scope discussed for this issue. This includes the PostgreSQL full-text search layer, fuzzy search using I also updated the file/folder structure based on the feedback:
Local validation has passed for both Virginia-style and Ireland-style schema clones. So from the DB side, the scoped code-level implementation package is ready. The remaining items are QA/RDS deployment and validation, query plan checks on real data, |
|
@PallaviChitrada10 as discussed in the de-boarding meeting, I have added a |
Description
This PR adds the database-side search implementation layer for PostgreSQL-backed search across the Saayam database schemas. Ref Issue: #184 and part of #207
The goal is to provide the Phase 1 search foundation using native PostgreSQL full-text search and
pg_trgmfuzzy matching, while keeping the scripts schema-agnostic so theycan run against both the Virginia and Ireland database schemas through
search_path.The fuzzy search scope is intentionally limited to the MVP search entities: requests, users, and organizations. It is not applied globally to every table.
Context
This work follows the Saayam Search Implementation Plan and the database-side search requirements discussed for the search implementation layer.
Current scope:
pg_trgmFuzzy Search Scope
Fuzzy search is supported for the following entities and fields:
Requests:
request.req_subjrequest.req_descrequest.req_lochelp_categories.cat_namethrough request-category joinUsers:
users.full_nameusers.primary_email_addressOrganizations:
organizations.org_nameorganizations.city_nameNotes:
req_locis text-based location matching, not geo-distance filtering.Changes
Added search migration scripts under
ddl/Search/:01_enable_fuzzy_search.sql02_add_request_search.sql03_add_user_and_volunteer_search.sql04_add_category_and_advanced_search.sqlAdded request search support:
search_vectoronrequesthelp_categories.cat_namereq_locsearch_requests(...)functionAdded user search support:
search_vectoronuserssearch_users(...)functionAdded organization search support:
search_organizations(...)functionAdded schema-agnostic execution:
search_pathsearch_pathtovirginia_dev_saayam_rdbmssearch_pathtoproposed_saayamAdded local validation setup under
tests/Search/:test_clones/runners/virginia_validation/ireland_validation/Behavior / Safety
No application or API behavior is changed in this PR.
The database search functions are additive and are introduced as callable DB-side search entry points.
Compatibility boundary:
search_path, not duplicated scripts.Authorization-aware filtering is included at the function level:
This is DB-side authorization-aware filtering, not the final production RBAC/session model. Final RBAC/session enforcement remains a backend and DevSecOps follow-up.
Risk boundary is moderate-low for local validation:
How to Run
Run the migration runner for the target schema.
Virginia:
Ireland:
Then run the corresponding validation suite:
Validation
Executed and passing locally against a fresh Virginia-style test clone:
Result:
Executed and passing locally against a fresh Ireland-style test clone:
Result:
Final local validation databases after file/folder reorganization:
Follow-ups
Planned next steps after this PR: