All posts

Smart Product Search - 4 AI-Backed Features That Cope with Customer Typos

A shopper who mistypes a query should still find the product. 4 search features, from typo tolerance to language-model ranking, and the data behind them.

A shopper types "electric bke 29 inch" and gets an empty page, or 400 results unrelated to the question. At that moment the shop loses a person who knew what they wanted and was ready to pay.

The four search features described below, from typo tolerance to ranking with a language model, work only as well as the catalogue data they search.

What a search box that finds nothing costs

A shopper who uses the search box usually knows what they are looking for. It is the most decided traffic a shop has, and the first to leave when the results list is wrong.

An empty results page has two sources. The first is a query the engine cannot handle, meaning a typo, a plural, an abbreviation or a colloquial name instead of the name from the price list. The second is a catalogue where the product exists, but in a form no engine will match. In the Trippi catalogue the same product arrived from several distributors, each with its own spelling of the name and its own set of attributes. A search engine on top of such a catalogue can cost any amount and will still show three pages for the same bike, or none.

The cost of inaction has two lines. The first is sales that did not happen because the shopper could not find a product the shop had in stock. The second is the work of a team that adds synonyms by hand and answers emails asking whether the shop carries a model it has stocked for a year. Both lines grow with the catalogue. At 500 products they can be worked around manually, at 12,000 SKUs they cannot.

Take the last 20 zero-result queries from the search logs and check by hand how many of those products were in stock. The answer tells you whether the problem sits in the engine or in the data.

Three approaches to search in an online shop

The comparison is qualitative. The outcome of each approach depends on the catalogue size, the number of suppliers and the state of the product data today. Figures from one implementation are in the Trippi section below.

Approach Typo in the query Synonym or colloquial name What happens when the data is inconsistent Work on the company side Changing the rules Dependence on the software vendor
Search built into the shop platform (text matching in the database) Zero results Zero results unless a keyword was added by hand Returns everything that matches as text, duplicates included Adding keywords to products by hand Limited to what the platform anticipated Tied to the shop platform
External search service (SaaS with typo tolerance and an AI model) Match despite the typo Synonym dictionary maintained in the service's panel Indexes the data as it arrived. Duplicates and missing attributes reach the results Maintaining the dictionary and ranking rules in someone else's panel Within the service's configuration High. Index, dictionary and rules live with the vendor, priced per query or per record
Own engine on top of a structured catalogue (product schemas, attributes with units) Match against a single canonical name Synonyms tied to categories and attributes instead of individual products Fails the import, so never reaches the results Enforcing the schema at import from suppliers The rules are code the company owns Low. The engine can be replaced, the data stays

The third approach does not rule out the second, because an external service also works better on a structured catalogue. In the second approach the team patches the effects of bad data in the service's panel, product by product. In the third it structures the data once, at import. We build shops on Laravel and Lunar PHP, both MIT-licensed, with no licence fees. Product schemas are handled by our package wizcodepl/lunar-product-schemas, the same one that guards the Trippi catalogue. The scope of such a project is described on the tailored B2C e-commerce page.

A query's route from the search box to the results list

The flow below shows what the system does with the query "electric bke cube 29 inch 625wh". Each step uses data that someone prepared earlier.

  1. The shopper types the query. The system splits it into words and numbers and reduces words to their base form, so "bikes" equals "bike".
  2. For each word the system looks for a match in the index with a tolerance of 1-2 swapped letters. "Bke" hits "bike", because the index holds one form of that word.
  3. The word "cube" is compared against the brand list. It hits, because the brand has one canonical name in the catalogue instead of four spelling variants.
  4. "29 inch" and "625wh" are recognised as attribute values, meaning wheel size in inches and battery capacity in watt-hours. They turn into filters, as if the shopper had ticked them on the listing.
  5. The synonym dictionary adds "e-bike" and "ebike" to the query, because in the electric bikes category they mean the same thing.
  6. The engine returns a list where one model is one result, and the frame size and colour variants sit inside the product page.
  7. Ranking orders the results by match, availability and price, plus a similarity score if the shop has a language model in the ranking.
  8. The shopper sees the list and the filters that have coverage in that list.

Steps 3, 4 and 6 need data a typical multi-supplier catalogue lacks, meaning one brand name, units on attributes, and variants separated from deduplicated products.

Four features that depend on catalogue data

The four features below differ in the kind of query they handle. Each needs a catalogue where a product appears once, a brand has one name, and attributes have a type and a unit.

Typo tolerance on a single product name

Typo tolerance is approximate matching. The engine counts how many letters must be changed, added or removed to turn the typed word into a word from the index, and accepts matches at a distance of 1 or 2. "Shimano" typed as "shimno" hits.

The problem starts when the index holds several versions of the same name. If a brand appears in the catalogue as "Cube", "CUBE Bikes", "Cube-Bikes" and "cube bikes gmbh", approximate matching scatters that brand's products across four groups with different match scores. Some bikes land at the top, some on page three, and the shopper concludes the range is narrower than it is. Uniform naming of brands and models, introduced in the Trippi shop in place of four spelling conventions for the same manufacturer, is the condition for typo tolerance to produce one list.

The brand and model name has to be settled at import, because the next price list update overwrites any correction made by hand.

A synonym dictionary tied to categories and attributes

Shoppers rarely use the names from a distributor's price list. They write "ebike", "e bike", "electric bicycle", "bike with a motor". A synonym dictionary maps the shopper's words onto the catalogue's words.

On most platforms the dictionary is a list of word pairs for the whole shop, or keywords added by hand to each product. At 12,000 SKUs the second option cannot be maintained, and the first confuses categories. "Disc" in the bikes category means a value of the brakes attribute, and in the parts category it is a separate product.

The feature that can be maintained is synonyms tied to categories and to attribute values. "Disc" in bikes then points to the brakes attribute value, in parts to a product type. The dictionary holds a few dozen entries instead of a few thousand, and a new product inherits the synonyms of its category and attributes with no manual work. The condition is a category tree that reflects how shoppers name things, and attributes with fixed values. In Trippi the "Electric" listing holds 1,368 products split into subcategories.

Numbers and units pulled out of the query

A large share of queries in shops with a technical range contains a number, such as "29 inch" or "625 wh". A plain text search treats "29" as a word and looks for it in descriptions. It hits catalogue numbers, weights and model years.

The system recognises a number plus unit pair in the query and turns it into an attribute filter. "29 inch" becomes a wheel size filter, "625 wh" a battery capacity filter. The shopper gets the same result they would get by ticking the filters on the listing. Service vendors call this part of search intent recognition, and underneath it is a mapping from a fragment of the query to a field in the database.

The feature fails when attributes have no units. When one supplier gives battery capacity in watt-hours, a second in amp-hours and a third writes it into the description as "battery 625", the system has no single field to attach the filter to. In Trippi the product schema enforces that battery capacity is a number in watt-hours and wheel size a number in inches, regardless of which of the four distributors sent the product. The system also enforces what must be filled in before publication, so an electric bike without a battery capacity does not reach the shop.

The same mechanism drives the filters on the listing. In Trippi filter values come straight from attributes, so a filter with no coverage in the data cannot be published, and a filter with no results is not shown.

A language model in results ranking

The fourth feature is the one that search service vendors call AI. A language model turns the product description and the shopper's query into strings of numbers, and the engine calculates the distance between them. The query "bike for commuting to work with a rack" contains no word from any product name, and still hits city and trekking bikes with a rack, because their descriptions sit close to such a query. The model calculates text similarity based on which words appeared together in the material it was trained on.

The second element is ranking based on shopper behaviour. The system records which results after a given query were clicked and bought, and moves them up in subsequent results. After a few weeks, "bike for a 6 year old" shows at the top the models parents chose most often.

In both elements the quality of the result depends on the text the model receives. If the same bike has three product pages from three suppliers, the model produces three near-identical strings of numbers and returns three top results that are one product. Deduplication and variant separation, done in Trippi before any front-end work, are the condition for model-based ranking to return different products instead of one product in several copies.

In B2B this element delivers less. In the B2B portal for iBox, more than 30 customers order from a catalogue of over 8,000 items from five manufacturers. A customer most often repeats a previous order or knows the model they are ordering, so descriptive queries barely occur. A single canonical product name and a catalogue number in a separate field give the same benefit there as in a consumer shop. The differences between a B2C shop and a B2B procurement platform lie in price lists and trade credit limits.

Trippi - 22,000 items from four distributors, 12,000 SKUs in the shop

Challenge. Trippi sells bikes, e-bikes and cycling accessories in a shop built on Lunar PHP and Laravel. The catalogue comes from four distributors, each describing the same equipment differently. Together over 22,000 items, of which 12,000 SKUs are meant to go on sale. The starting point was data in the form each supplier sent it. Filters were one set for the whole shop, shared by bikes, helmets and locks. Connecting a new supplier took 2-3 weeks of developer time. The route to a product ran through the search box and the name as written in the price list.

Solution. The work went into the data before anyone touched the shop's front end. Deduplication of products carried by several suppliers, so that one model is one product page. Uniform naming of brands and models in place of four spelling conventions. Variants, meaning frame size and colour, separated from distinct products. Product schemas in which an electric bike, a children's bike, a helmet and a lock each have their own set of attributes with types and units. Filters tied to categories, with values taken straight from attributes. Data from each of the four suppliers is brought to this standard at import.

Results. The shop holds 12,000 SKUs selected from 22,000, according to rules Trippi changes without a developer. The "Electric" listing holds 1,368 products split into subcategories, and the search box works on the same catalogue as the filters. Connecting a new supplier went from 2-3 weeks to 2-3 days. Each of the four features above can run on this catalogue without structuring the data again.

Checklist for the board

Questions to check before deciding on AI-backed search:

  • How many queries in the shop's search box last month ended with zero results, and how many of those products were in stock?
  • Is the same product from two suppliers one product page in the shop, or two?
  • How many spelling variants does the best-selling brand have in the catalogue?
  • Are capacity, size and weight separate fields with a unit, or a fragment of the description?
  • Who decides which products from a supplier's price list enter the shop, and can that be changed without a developer?
  • Where is the synonym dictionary kept, in the shop's code, in an external service's panel, or in someone's head?
  • Does the shop record what shoppers typed and what they clicked afterwards?
  • How long does connecting a new supplier take, and who does it?

Let's talk about search in your shop

If shoppers in your store type a model name and get an empty page, and your team adds synonyms by hand, this is a good moment to talk. Show us a catalogue export from one supplier and the search logs from the last month, and we will tell you which of the four features would work right away and which is waiting on the data. How we build such shops is described on the tailored B2C e-commerce page. The whole Trippi project, from range selection rules to filters, is in the Trippi case study.

About the author

Kuba Szcześniak

Kuba Szcześniak

Founder · Lead engineer

I work with wholesalers, distributors and retailers who have outgrown an off-the-shelf platform: a catalogue from several suppliers, individual price lists and processes no SaaS will carry.