feat(search+docs): trigram fuzzy search, brand/country filters, developer docs
Search: - migration 0009: trigram GIN index on brand.name + btree on country_of_origin - SearchProducts: typo-tolerant word_similarity matching (>=0.42) on top of ILIKE substring + barcode; new brand/country filters; rank by similarity * (0.5 + quality_score). Response gains country_of_origin, quality_score and per-result relevance score. - public search UI: brand/country filter inputs; show country in results Docs: - serve embedded OpenAPI 3 spec at GET /api/v1/openapi.json (not rate limited) - ApiDocs page: auth + rate-limit section, updated search params/response - docs/api.md developer guide Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
DROP INDEX IF EXISTS idx_product_country;
|
||||
DROP INDEX IF EXISTS idx_brand_name_trgm;
|
||||
@@ -0,0 +1,9 @@
|
||||
-- Search upgrade: trigram-based fuzzy matching + brand/country filters.
|
||||
-- pg_trgm and the product.name GIN index already exist (see 0001). Add a
|
||||
-- matching trigram index on brand.name so brand filtering / fuzzy brand
|
||||
-- lookups can use an index instead of a sequential scan.
|
||||
CREATE INDEX IF NOT EXISTS idx_brand_name_trgm ON brand USING gin (name gin_trgm_ops);
|
||||
|
||||
-- country_of_origin is filtered by exact/prefix match; a plain btree index
|
||||
-- keeps that cheap as the catalog grows.
|
||||
CREATE INDEX IF NOT EXISTS idx_product_country ON product (country_of_origin);
|
||||
Reference in New Issue
Block a user