E-commerce search fails in two opposite ways. BM25 keyword search can't tell that "evening wristwatch" and "dress watch" mean the same thing. Pure vector search happily returns "something watch-like" when the shopper typed an exact SKU. This R&D engine runs both and fuses the results, on a Solr 9 core of about 540 real catalog products, without touching the production search path.

#1. The Pipeline

Diagram
query ─▶ SKU short-circuit ─▶ split into item clauses ─▶ for each clause:
   ├─ price phrase parser        (under / between / ~ / 12k)
   ├─ rule-based NLU             (brand, category, colour, size, badge, type)
   ├─ fuzzy fallback             (Solr ~2 edit distance on *_text fields)
   ├─ in-process ONNX embedding  (all-MiniLM-L6-v2, 384 dims)
   ├─ BM25 keyword search        (edismax)
   ├─ kNN vector search          ({!knn f=vector topK=N})
   └─ RRF fusion
─▶ merge clauses ─▶ de-dup by style ─▶ page ─▶ UI view model

#2. Reciprocal Rank Fusion

BM25 scores and cosine similarities live on different scales, so you can't just add them. RRF ignores scores and uses only rank positions:

Text
score(doc) = Σ over result lists  1 / (K + rank(doc))      K = 60

A product ranked well by both retrievers rises to the top. One found by only one retriever still gets a fair share. The same primitive powers the "similar products" endpoint, where it fuses vector similarity with Solr's MoreLikeThis.

#3. Embeddings Without an API Call

  • all-MiniLM-L6-v2 in ONNX format, run in-process with Microsoft.ML.OnnxRuntime, tokenised with FastBertTokenizer.
  • Mean-pooled and L2-normalised into a 384-dimensional vector. The query is embedded live; product vectors are precomputed and stored in Solr.
  • No network hop and no per-query cost for an external embedding API.

#4. Query Understanding Without an LLM

The NLU is deterministic and explainable: lexicon lookup and regex against a live vocabulary. A BackgroundService refreshes the real distinct values in the index (brands, colours, categories and so on) every five minutes using Solr facet queries. When the catalog changes, the parser updates without a redeploy.

  • Typos: "Chrons" resolves via Solr's native fuzzy operator. A curated stop-word list (~60 words) stops common English words from being offered as fuzzy matches.
  • Synonyms live in Solr, not in C# dictionaries. Gender and size moved to *_text fields backed by synonyms.txt.
  • Prices: "under X", "between X and Y", reversed phrasing, "~X" (±10%), "12,000" and "12k".

#5. Multi-Intent Queries

"red card case and gold tone watch under 5000" is two searches. Splitting on commas and a standalone "and" (while protecting "between X and Y" and "12,000") lets each clause run the entire pipeline with its own price and filters. Otherwise the watch clause's category filter would starve the card-case clause.

The reverse case matters too

In "black and blue watches", "black" is only a modifier. Clauses that contain nothing but a colour, brand or gender word get merged into their neighbour, so they don't trigger a catalog-wide search for "black".

#6. The Details That Make It Feel Right

  • Style-level de-dup: the same style in three colours shows once, with its colour swatches harvested through Solr collapse + expand.
  • Phrase proximity (pf2) reranks adjacent-word matches above bag-of-words hits.
  • Business signals (rating, sale count, availability) as an edismax boost function that nudges relevance but doesn't override it.
  • Embedded SKUs ("watch CR6121") are forced to position one.
  • Autosuggest through Solr's Suggester component for fast prefix and infix matches.

#7. Takeaways

  • Hybrid beats either retriever alone, and RRF is the simplest fusion that works without score calibration.
  • You don't need an LLM for query understanding in a bounded domain. A live vocabulary and good rules are faster, cheaper and explainable.
  • Push linguistics (synonyms, fuzziness, suggesters) into the search engine, and keep the application code for orchestration.