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
Open
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.#949DevScoopee wants to merge 1 commit into
DevScoopee wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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