Fix: Move catalog search indexes to ETL migration
This commit is contained in:
@@ -1,14 +0,0 @@
|
|||||||
-- Migration: Add full-text search index for vehicle catalog search
|
|
||||||
-- Date: 2025-12-15
|
|
||||||
|
|
||||||
-- Add full-text search index on vehicle_options table
|
|
||||||
-- Combines year, make, model, and trim into a single searchable tsvector
|
|
||||||
-- Using || operator instead of concat() because || is IMMUTABLE
|
|
||||||
CREATE INDEX IF NOT EXISTS idx_vehicle_options_fts ON vehicle_options
|
|
||||||
USING gin(to_tsvector('english', year::text || ' ' || make || ' ' || model || ' ' || trim));
|
|
||||||
|
|
||||||
-- Add an index on engines.name for join performance during search
|
|
||||||
CREATE INDEX IF NOT EXISTS idx_engines_name ON engines(name);
|
|
||||||
|
|
||||||
-- Add comment for documentation
|
|
||||||
COMMENT ON INDEX idx_vehicle_options_fts IS 'Full-text search index for admin catalog search functionality';
|
|
||||||
@@ -75,6 +75,13 @@ CREATE INDEX idx_vehicle_year_make_model_trim ON vehicle_options(year, make, mod
|
|||||||
CREATE INDEX idx_vehicle_year_make_model_trim_engine ON vehicle_options(year, make, model, trim, engine_id);
|
CREATE INDEX idx_vehicle_year_make_model_trim_engine ON vehicle_options(year, make, model, trim, engine_id);
|
||||||
CREATE INDEX idx_vehicle_year_make_model_trim_trans ON vehicle_options(year, make, model, trim, transmission_id);
|
CREATE INDEX idx_vehicle_year_make_model_trim_trans ON vehicle_options(year, make, model, trim, transmission_id);
|
||||||
|
|
||||||
|
-- Full-text search index for admin catalog search
|
||||||
|
CREATE INDEX idx_vehicle_options_fts ON vehicle_options
|
||||||
|
USING gin(to_tsvector('english', year::text || ' ' || make || ' ' || model || ' ' || trim));
|
||||||
|
|
||||||
|
-- Index on engines.name for join performance during search
|
||||||
|
CREATE INDEX idx_engines_name ON engines(name);
|
||||||
|
|
||||||
-- Views for dropdown queries
|
-- Views for dropdown queries
|
||||||
|
|
||||||
-- View: Get all available years
|
-- View: Get all available years
|
||||||
|
|||||||
Reference in New Issue
Block a user