GuidesAI and e-commerce
Semantic search for an online store
Keywords or meaning
Keywords
Meaning
The architecture
- 1Product pagesTitle, description, material, uses.
- 2EmbeddingsOne vector per product, recomputed on every change.
- 3Hybrid searchKeyword and meaning rankings merged.
- 4FiltersPrice, size, stock, applied before display.
With PostgreSQL
SELECT id, title
FROM products
WHERE in_stock AND price <= 120
ORDER BY embedding <=> $1 -- query vector
LIMIT 24;
The pgvector extension stores vectors next to the product data; PostgreSQL full-text search provides the keyword ranking.
What to measure
| Metric | What it tells you |
|---|---|
| Zero-result searches | Gaps in the catalogue or the search |
| Clicks on top results | How relevant the ranking is |
| Sales after search | The real value |
The technical base: RAG with PostgreSQL and pgvector. Vectors: vector databases explained.
Frequently asked questions
- Should I drop keyword search?
- No. A product reference or a brand is better found by keywords. Hybrid search combines both rankings.
- Doesn't Shopify already do this?
- Shopify's search keeps improving and apps add meaning-based search. Custom work makes sense for a special catalogue or a headless store.
- How do I know it works?
- Track the zero-result rate, the click rate on results and sales that follow a search, before and after.