r/intersystems • • Oct 30 '26

Why vector search alone can’t replace keyword search in e-commerce: lessons from a production build on InterSystems IRIS, plus a RAG-to-SQL assistant benchmark

https://youtu.be/QfYAbSy0l_I

A UK software house with about 30 years of ERP and e-commerce experience (MTech Computers) tried to replace keyword search with semantic search using IRIS vector indexing. They expected the vector index to solve everything. It didn’t. Here is what they found, followed by two other production results from the same session.

Why keyword search fails shoppers

  • A few keywords that don’t match the product descriptions return zero results, and many customers then leave the site
  • Keyword search also returns irrelevant items, such as blue patterned dresses for a blue patterned top

Semantic search should help on both fronts: it finds the nearest match instead of nothing, and it understands that blouses and t-shirts are tops, and that pants, trousers, and chinos are related.

What went wrong with vector search alone

Unusual color names. A fashion client described products with colors like petrol ink, moss, and eggplant. The vector index didn’t understand them as colors. Fix: an LLM converted them into a palette of about 13–14 primary colors, and the descriptions were enhanced with those colors before indexing.

Scores that don’t match human expectations.

SearchWhat the vector index did
Indoor lightsReturned outdoor lights as semantically very similar
White short-sleeve dressBlack, blue, and yellow dresses scored as near matches
Air coolersFans scored low, even though the shop wanted to show them

With only a score to go on, you must draw a line somewhere. Everything above it is shown, everything below is hidden. That line shows irrelevant items and hides relevant ones.

What worked: vector index plus LLM reranking

The vector index selects the nearest 50–100 products. They are sent to an LLM (ChatGPT, for example) with detailed instructions to rerank them. The instructions are tailored per market. For the fashion site: if it’s a different garment, don’t return it, and if a color is specified and it differs, don’t return it.

Non-determinism. The LLM might return 49 products, then 51, then 48 for the same input. Workaround: store a customer’s results for a few seconds, so a repeated search returns the same results. It is short-term only, to avoid making the search look broken.

Results on the fashion site:

  • “Blue shorts” now finds products previously described as petrol ink
  • A body warmer search finds sleeveless sweaters, although the word never appears in the catalog
  • “Green cord pants” finds trousers and chinos, since the customer never uses “pants”
  • “Something to wear outside” and “a comfy cardi” return relevant products. A keyword search would find nothing

What didn’t work

  • Late interactive retrieval (LIR): it scores individual words and combines them. Some attributes overweighted the result, so a high score for “blue” and “striped” produced a blue striped dress instead of shorts
  • Cross-encoders: same problem, since they are score-based and you still have to decide where to draw the line

What still needs handling after semantic search works

  • Stock: the most semantically correct item is no use at the top if it isn’t in stock
  • Age: a client asked why old products appeared first, so results are re-ranked by age after the vector index and LLM steps

Operational notes from the InterSystems side

  • Build a framework to benchmark embedding models and techniques against your own real queries. Every use case is different, and new embedding models keep appearing
  • Performance wasn’t a big issue here because a fashion retailer has a small dataset, not millions of rows
  • Cold start: the first semantic search was slow because the models had to be loaded into memory. A slimmed-down version of the embedding models kept in memory removed that latency
  • LIR was also tried to avoid the LLM call in the rerank step, which costs about one to two seconds

Same session: two production AI solutions by Shift

Recommender (laboratory exams). Compared to a simple statistical baseline, it showed around 30% better NDCG@5 without an index. With the HNSW index, latency improved by up to 98%. Planned next: upgrade IRIS to use the HNSW index in production, add features to patient vectors, and add text embeddings of clinical notes.

Shift Assistant (inside their LIS). Users ask business questions in natural language. RAG identifies the most relevant data sources, generates SQL, executes it in IRIS, and returns a natural-language answer.

  • Business terminology: text embedding models are fine-tuned with domain-specific language and applied to the data warehouse schema, so tables and fields become vectors in a shared semantic space. The same model embeds user prompts, so vector search matches questions to the right data sources. New sources can be added without changing the architecture.
  • Benchmark: 21 scenarios covering SQL generation, complex reasoning, long context handling, and adherence to application guardrails. The scoring used LLM-as-a-judge (accuracy, context adherence, hallucination), validated against human Likert-scale reviews.
  • GPT-5.1 vs Gemini 2.5 Pro: both showed good overall accuracy. GPT-5.1 had higher context adherence and a lower hallucination rate, but more SQL execution errors, a trade-off between semantic quality and execution robustness.
  • Next steps: a knowledge base of curated SQL prompt examples, including corrected examples of semantically incorrect SQL, and IRIS-dialect-aware SQL patterns to reduce execution errors.

Takeaways

  1. Get your data right before indexing
  2. A vector index alone did not give good enough matches to replace keyword search
  3. LLM reranking with market-specific rules closed the gap
  4. Aligning AI behavior with human expectations was harder than the AI itself

If you’ve replaced keyword search with semantic search, what did you have to add on top of the vector index: LLM reranking, business rules like stock and recency, or something else?

3 Upvotes

0 comments sorted by