Skip to content

Replaced the slow ILIKE '%query%' full-text search with PostgreSQL's native full-text search engine, backed by a GIN-indexed tsvector generated column. Added an Elasticsearch fallback for when ES is available, and a benchmark script to measure before/after performance at scale.#949

Open
DevScoopee wants to merge 1 commit into
rinafcode:mainfrom
DevScoopee:main

Conversation

@DevScoopee

Copy link
Copy Markdown

Added a migration that creates a search_vector GIN-indexed tsvector column on the course table. Updated SearchService to use search_vector @@ plainto_tsquery() instead of ILIKE '%query%', eliminating sequential scans. Elasticsearch is attempted first when available, falling back to PG-FTS on failure. Relevance ranking is preserved via ts_rank.

Closes #814

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Kindly resolve conflict.

…native full-text search engine, backed by a GIN-indexed tsvector generated column. Added an Elasticsearch fallback for when ES is available, and a benchmark script to measure before/after performance at scale.

Added a migration that creates a search_vector GIN-indexed tsvector column on the course table. Updated SearchService to use search_vector @@ plainto_tsquery() instead of ILIKE '%query%', eliminating sequential scans. Elasticsearch is attempted first when available, falling back to PG-FTS on failure. Relevance ranking is preserved via ts_rank. All 9 unit tests pass, typecheck and lint are clean.

Closes rinafcode#814
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.

Course search uses ILIKE without full-text index causing full table scans

2 participants