mirror of
https://github.com/multica-ai/multica.git
synced 2026-06-17 03:38:32 +02:00
* fix(search): use LOWER/LIKE instead of ILIKE for pg_bigm 1.2 compatibility pg_bigm 1.2 on RDS does not support ILIKE index scans. Replace all ILIKE expressions with LOWER(column) LIKE LOWER(pattern) so the GIN indexes are utilized. Rebuild gin_bigm_ops indexes on LOWER() expressions. Closes MUL-482 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(search): lowercase pattern in Go, add buildSearchQuery unit tests - Lowercase phrase/terms in Go (strings.ToLower) so SQL only needs LOWER() on the column side, avoiding redundant per-query LOWER() on the pattern - Add 5 unit tests for buildSearchQuery asserting SQL shape: no ILIKE, LOWER on columns only, lowercased args, multi-term AND, number match, include-closed flag, special char escaping Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
22 lines
701 B
SQL
22 lines
701 B
SQL
-- Revert to original (non-LOWER) pg_bigm indexes.
|
|
DROP INDEX IF EXISTS idx_issue_title_bigm;
|
|
DROP INDEX IF EXISTS idx_issue_description_bigm;
|
|
DROP INDEX IF EXISTS idx_comment_content_bigm;
|
|
|
|
DO $$
|
|
BEGIN
|
|
CREATE INDEX idx_issue_title_bigm ON issue USING gin (title gin_bigm_ops);
|
|
CREATE INDEX idx_issue_description_bigm ON issue USING gin (COALESCE(description, '') gin_bigm_ops);
|
|
EXCEPTION WHEN OTHERS THEN
|
|
RAISE NOTICE 'skipping bigram indexes on issue (pg_bigm not installed)';
|
|
END
|
|
$$;
|
|
|
|
DO $$
|
|
BEGIN
|
|
CREATE INDEX idx_comment_content_bigm ON comment USING gin (content gin_bigm_ops);
|
|
EXCEPTION WHEN OTHERS THEN
|
|
RAISE NOTICE 'skipping bigram index on comment (pg_bigm not installed)';
|
|
END
|
|
$$;
|