Documentation Index
Fetch the complete documentation index at: https://docs.uselayers.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Query interpretation is an AI-powered preprocessing step that runs early in the search pipeline. It 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, the query interpretation system 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:| Route | When it applies | What happens |
|---|---|---|
| None | The query is a normal product search | Search proceeds normally. If a typo was detected, the corrected query is used. |
| Redirect | The query looks like a help, policy, or informational request | The system generates candidate phrases and checks them against your semantic redirects. If a match is found, the customer is redirected. |
| SKU prefix | The query resembles a product code, model number, or SKU | The system uses prefix matching to find products whose codes start with the query, bypassing semantic 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 now happens inside the interpretation step, it benefits from store context. The system 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. This means your semantic redirects now catch a wider range of natural-language queries without you needing to anticipate every variation. A redirect configured for “return policy” can now match queries like “how do I send something back” or “what’s your refund process”. The interpretation system generates the right candidate phrases automatically.Saved redirect term awareness
The interpretation system is aware of your configured semantic redirect terms. When you have redirect terms set up, the system constrains its candidate generation to only select from those terms. This prevents the AI from inventing redirect phrases that don’t match anything in your configuration. It reduces false positives and ensures that redirect routing only fires when a real redirect destination exists. If no saved redirect terms are configured, the system falls back to conservative behavior and only routes queries for very explicit help, policy, support, or store-information intent. This means the more semantic redirects you configure, the smarter redirect routing becomes — the system uses your existing terms as a vocabulary to match against incoming queries.Gift card queries
Queries for gift cards are always treated 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 embeddings to match queries to configured redirect terms. Query interpretation adds an additional layer by first interpreting the query’s intent and generating focused candidate phrases, which are then checked against your redirects. This two-step approach catches queries that semantic embedding similarity 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. This is especially useful for B2B stores, wholesale catalogs, or any store where customers frequently search by product codes.Caching
Interpretation results are cached automatically. When the same query is searched again, the cached result is used instantly without additional processing. This ensures that the interpretation step 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 the dashboard