Revolutionizing E-commerce Search with Vectors
A primer on why vector search matters for e-commerce: how dense vectors relate to the inverted index, how semantic similarity fixes vocabulary mismatch, the four steps to vectorise a catalogue, and side-by-side query examples from the Chorus demo shop.
This write-up was first published at opensourceconnections.com. Below is a summary and what we would add today.
Published on the OpenSource Connections blog in March 2023, this post grew out of Atita's talk at Haystack on Tour in Kraków, co-hosted by OSC and edrone. It is the conceptual half of a pair; the technical implementation follows in Building Vector Search in Chorus.
What the article covers
The post starts by placing vector search in the history of information retrieval rather than presenting it as new. The inverted index is read as a sparse vector model whose dimensions are the vocabulary; dense vector search is the normalised, fixed-dimension version of the same idea. A vector-space illustration of a product catalogue shows how laptops, tablets and phones cluster together while baby products sit elsewhere, which is what lets a query like "baby backpack" land between backpacks and baby goods and retrieve sensible products even when no item carries that exact name.
The practical argument is about vocabulary mismatch: customers describe products in words retailers never used, and the usual fixes (synonyms, stemming, spell-checking, query rewriting) are manual and never complete. Vector search compares the meaning of the query with the meaning of each product and helps most in the low-recall situations of long-tail queries, multilingual traffic and zero-result searches.
The post lays out four steps to vectorise an e-commerce search (gather product data, encode text and images into embeddings, change the search algorithm to use them, test and optimise) and then shows results from the open-source Chorus demo shop. Against the default Solr edismax configuration, vector queries return actual notebooks instead of notebook accessories, projector screens instead of projector lamps, the right toner cartridges for a misspelled query, and, with image vectors used as a boost on BM25, network cables instead of adapters. CLIP handles images and MiniLM handles text, because of CLIP's token limit.
What I would add today
The examples still hold up, but I would frame the conclusion more carefully now: vectors change which queries fail, they do not eliminate failure, and the exact-match queries that BM25 handles well remain a large share of real e-commerce traffic. The hybrid boost example at the end of the post turned out to be the most durable idea in it. And the four steps are missing a zeroth one that I now insist on: have a judgment set before you touch the algorithm, so that "better" is measured rather than eyeballed.
Related talks and articles
- External write-up · 22 Mar 2023Building Vector Search in Chorus: a technical deep dive
- Talk · Community Over Code North America 2023 (Apache Software Foundation), Halifax · 7 Oct 2023Transforming Your Search with Cutting-Edge Techniques and LLM Models
- Talk · Haystack On Tour Krakow 2023 (OpenSource Connections x edrone) · 23 Feb 2023Vectorise your E-commerce Search