Overview
Query interpretation is an AI-powered preprocessing step that runs early in the search pipeline. It is one stage of query understanding, the full set of steps Layers uses to interpret a search, which also includes query expansion, intent detection, and contextual personalization. Query interpretation analyzes every search query in the context of your store and makes up to three decisions:- Typo correction — Fixes clear spelling mistakes and expands common acronyms.
- Redirect routing — Identifies queries that are looking for help pages, policies, or other non-product content and routes them to your configured semantic redirects.
- SKU prefix detection — Recognizes when a query looks like a product code or SKU and switches to prefix-based lookup for faster, more accurate results.
How it works
When a customer searches, query interpretation evaluates the search terms alongside your store’s name and description. Using this context, it determines the most likely intent behind the query and returns one of three routing decisions:
Query interpretation is conservative. It only makes corrections or routing changes when the intent is clear. When it is uncertain, the query proceeds unchanged through normal search.
Typo correction
Query interpretation handles typo correction as part of its analysis. When it detects a likely spelling mistake, it returns a corrected version of the query that is used for the rest of the search pipeline. The correction respects the same principles as described in Typo tolerance: brand names, model numbers, stylized catalog spellings, and niche terminology are preserved. Only clear, high-confidence corrections are applied. Because typo correction happens inside query interpretation, it uses store context. Query interpretation considers your store’s product types and description when deciding whether something is a typo or an intentional term, reducing false corrections.Redirect routing
When a customer types a query like “how do I return my order” or “shipping policy”, they’re not looking for products. They want information. Query interpretation detects these non-product queries and generates short candidate phrases (like “returns”, “return policy”, “how to return”) that are matched against your configured semantic redirects. If a matching redirect is found, the search API returns a redirect response instead of product results, just as if the customer had typed the exact redirect term. If no matching redirect exists, the query falls through to normal search. Redirect routing lets your semantic redirects catch a wider range of natural-language queries without you anticipating every variation. A redirect configured for “return policy” can match queries like “how do I send something back” or “what’s your refund process”. Query interpretation generates the candidate phrases automatically.Saved redirect term awareness
Query interpretation reads your configured semantic redirect terms. When you have redirect terms set up, candidate generation only selects from those terms, so it can’t invent redirect phrases that don’t match anything in your configuration. This reduces false positives, and redirect routing only fires when a real redirect destination exists. If no saved redirect terms are configured, query interpretation falls back to conservative behavior and only routes queries for very explicit help, policy, support, or store-information intent. The more semantic redirects you configure, the more queries redirect routing can match. Query interpretation uses your existing terms as a vocabulary to match against incoming queries.Gift card queries
Query interpretation always treats gift card queries as product searches, even when your store has redirect terms related to gifts such as “gift guide” or “gifting page”. This prevents shoppers looking to purchase a gift card from being redirected to an unrelated gifting content page. If a customer searches “gift card”, they see gift card products in the search results rather than being routed away from the catalog.How redirect routing differs from semantic matching
Semantic redirects already use AI to match queries to configured redirect terms by meaning. Query interpretation adds a step before that: it interprets the query’s intent and generating focused candidate phrases, which are then checked against your redirects. This two-step approach catches queries that direct semantic matching alone might miss, particularly conversational or question-style queries.SKU prefix detection
Some customers search using product codes, model numbers, or partial SKUs. These queries don’t work well with semantic or keyword search because “WKR04” has no meaningful words to match against. Query interpretation recognizes these patterns and switches the search to prefix-based matching, which finds products whose SKU or product code starts with the entered text. Layers matches the query against variant SKUs, barcodes, and any metafield attributes with the identifier class. Assign that class to metafields that store MPNs, style numbers, or UPCs so shoppers can find products by those codes. Layers also learns the identifier shapes in your catalog automatically. It samples the values stored in identifier-class attributes and SKUs to recognize the patterns your store actually uses, such as a fixed prefix followed by digits or a specific length and character mix. Shoppers get prefix routing when they type a code that looks like one of yours, even if the shape is unusual for product codes in general. Learning runs continuously as your catalog changes, so new identifier formats start routing correctly without configuration. Identifier and SKU searches keep the code the shopper entered. Layers does not replace it with a different canonical or clustered query. If an identifier-like query contains natural-language text and no code matches, it falls through to normal search. A single-token query that matches a learned identifier shape stays in the identifier lookup lane; when no code matches, it returns no results instead of unrelated recommendations. This behavior is separate from shopper-applied filters, which narrow an otherwise normal search. SKU prefix detection is most useful for B2B stores, wholesale catalogs, or any store where customers often search by product codes.Show the matched variant
When an identifier lookup resolves to a specific variant, Layers returns that variant as the product’s matched variant. Your default selected options do not replace it with a different size, color, or other option. For example, if your default color is Black but the shopper enters the SKU for a Navy jacket, the matched variant is the Navy jacket. The same applies when a prefix lookup resolves to a variant. A code that only identifies the product does not necessarily identify a particular variant. Use the matched variant in your storefront’s product card to show its price, image, and options. See variant selection for how defaults and other search signals interact.Caching
Query interpretation results are cached automatically. When the same query is searched again, Layers uses the cached result, so query interpretation adds no latency for repeated searches.Transparency in the dashboard
When you test a search in the Layers dashboard, the Query Understanding panel shows interpretation results as a Query Routing step. You can see:- The routing decision (none, redirect, or SKU prefix)
- Any typo corrections that were applied
- The redirect candidate phrases that were generated (for redirect routing)
- The SKU candidate that was extracted (for SKU prefix routing)
See also
- Typo tolerance — Additional detail on how spelling corrections are handled
- Semantic Redirects — Configuring redirect destinations for non-product queries
- Query Understanding — The full query understanding pipeline
- Search API — Technical details on search requests and responses
- Test Text Search — Testing and debugging search queries in Lab