Skip to content
Menu
VARAi

AI product search, instant suggestions and a style bar on one engine

Natural-language product search for a Magento optical retailer, reading live store data, cached in Redis, and reused for type-ahead suggestions and a "similar frames" bar on product pages.

AI search · Recommendations · Redis caching · Magento integration

product
AI search and recommendations
platform
VARAi
role
CTO & forward-deployed AI engineer

Results

Repeat queries served from the Redis cache, skipping AI routing and the store's API
~2 s → ~50 ms
Scripted test suite, run side by side against the hosted search it replaced
107 queries
Intent parsing (52), AI fallback (56), autocomplete (22)
130 unit tests
Search, autocomplete and style bar services in five weeks: +3,807 / −1,518 lines
60 commits

Problems solved

8 problems
  1. 01The store's own search was the bottleneck

    broke
    Magento's full-text search missed obvious matches, so any layer built on it inherited the misses.
    changed
    Search now runs on our own catalogue index; Magento is called only for live prices, stock and URLs by SKU.
    proof
    Products with a 3D model sort first, and every result links to a live product page.
  2. 02The model invented category IDs

    broke
    The AI router sometimes returned the right category name with the wrong ID, which produced empty or wrong results.
    changed
    IDs are cross-checked against the name in the catalogue map, and a zero-result category falls back to all products with the other filters kept.
    proof
    Accessories stay excluded on fallback, so "glasses" never returns cases and cloths.
  3. 03The cache served the wrong currency

    broke
    Cache keys ignored the store view, so every region got the first region's prices.
    changed
    Keys are now tenant + store view + query; session IDs are stripped from cached payloads and injected per request.
    proof
    Gulf store views return their own currency on cached hits.
  4. 04No Redis, unbounded memory

    broke
    Without Redis the in-memory fallback cache grew with every new query.
    changed
    The fallback is capped at 1,000 entries and evicts the oldest first.
    proof
    Search keeps working with or without Redis attached.
  5. 05Model numbers got buried

    broke
    A query like brand + model number ranked general brand results above the exact frame.
    changed
    The model number is extracted and exact name or SKU matches are boosted to the top.
    proof
    Model-number queries are part of the 107-query test set.
  6. 06Type-ahead was empty on new stores

    broke
    Suggestions were built from past searches, so a 27,000-product catalogue with no history returned brands only.
    changed
    A fourth source queries the catalogue directly and writes hits back into the Redis prefix index.
    proof
    The same fix removed a duplicated search overlay that blocked typing on click.
  7. 07Suggestions showed the wrong price

    broke
    The dropdown showed base-currency prices to shoppers paying in another currency.
    changed
    Price was removed from suggestions; converting it live would add a 200–500 ms store call per keystroke.
    proof
    Prices stay on the product page, where the store converts them.
  8. 08A "similar frames" bar on contact lenses

    broke
    The style bar appeared on contact-lens pages, where similar glasses make no sense.
    changed
    Eligibility now keys on optical frame types only, and picks stay within 0.4–2.5× of the current product's price.
    proof
    Four unit tests cover the contact-lens exclusion.

Put the AI where it adds judgement, keep live commercial data with the store that owns it, and cache everything in between with keys that match how the store is split.

stack · Node.js / Express · PostgreSQL (trigram search) · Redis · Claude Haiku (intent routing) · Magento GraphQL · PHP (Magento module) · JavaScript widgets · Jest

More from VARAi

Need a senior AI engineer who can own delivery?

Tell me what you're building and where it breaks. I reply to every message myself.

Contract CTO · Principal AI engineering · Forward-deployed AI engineering · Enterprise AI architecture