A user’s search intent directly determines whether the results meet their needs. In OpenSearch, Query Planner interprets this intent by applying a series of intelligent analyses to rewrite the query before executing retrieval and sorting in the engine. Available query analysis features include synonym configuration, stop word filtering, spelling correction, term weight analysis, and category prediction. In E-commerce scenarios, Named Entity Recognition (NER) is also supported. This document describes each query analysis feature and provides concrete examples for E-commerce use cases.
Stop word filtering overview
Filter out meaningless terms from queries using the system’s built-in stop word dictionary. These are typically high-frequency words that do not affect search results, such as punctuation marks and modal particles.
Spelling correction overview
User queries are not always accurate. Typos can lead to unexpected or empty results, so input must be checked for spelling errors. OpenSearch’s spelling correction feature identifies and fixes misspelled terms in the query. Based on the confidence level of the correction, the system decides whether to use the corrected term for retrieval.
Term weight analysis overview
This feature evaluates the importance of each term in the query and assigns it a weight. Terms with low weights may be excluded from retrieval to prevent overly restrictive matching, which could otherwise reduce the number of relevant results when users include low-weight terms.
Basic introduction to the synonym feature
In real-world search scenarios, users often express the same concept using different words. For example, when searching for Apple phone, content containing iPhone should also appear in the results. Because users rarely include all possible synonymous terms in a single query, recognizing and expanding synonyms significantly improves recall rate. Synonym configuration expands the query with equivalent terms to retrieve more relevant documents.
Named Entity Recognition overview
Named Entity Recognition (NER) identifies semantic entities with specific meanings in the query. Based on the recognized entities and their types, query analysis rewrites the query using entity-specific weights to better match user intent. The rewrite prioritizes high-importance entities during retrieval. Low-importance terms do not affect retrieval but influence algorithmic sorting.
E-commerce query analysis example
Take the query Yang Mi's Nike slim-fit dress with free shipping. as an example. Without query analysis configured, the original query is:
query=(default:'Yang Mi' AND default:'same style' AND default:'Nike' AND default:'slim-fit' AND default:'dress' AND default:'free shipping' AND default:'.')
After enabling stop word filtering, the actual query becomes:
query=(default:'Yang Mi' AND default:'same style' AND default:'Nike' AND default:'slim-fit' AND default:'dress' AND default:'free shipping')
// Note: Punctuation has been filtered out as a stop word.
After adding spelling correction, the actual query becomes:
query=(default:'Yang Mi' AND default:'same style' AND default:'Nike' AND default:'slim-fit' AND default:'dress' AND default:'free shipping')
// Note: Spelling correction has corrected a misspelled search term to 'dress'.
After adding term weight analysis, the actual query becomes:
query1=(default:'Yang Mi' AND default:'same style' AND default:'Nike' AND default:'slim-fit' AND default:'dress' RANK default:'free shipping')
query2=(default:'Yang Mi' RANK default:'slim-fit' RANK default:'free shipping' RANK default:'same style' RANK default:'Nike' RANK default:'dress')
// Note: After configuring term weights, the low-weight term "free shipping" is excluded from retrieval. If query1 returns no results, the engine automatically triggers a re_search using query2 to avoid empty results.
After adding synonym configuration, the actual query becomes:
query1=(default:'Yang Mi' AND default:'same style' AND ((default:'Nike') OR (default:'nike')) AND default:'slim-fit' AND default:'dress' RANK default:'free shipping')
query2=(default:'Yang Mi' RANK ((default:'Nike') OR (default:'nike')) RANK default:'slim-fit' RANK default:'free shipping' RANK default:'same style' RANK default:'dress')
// Note: After configuring synonyms, "nike" is added as a synonym for "Nike". If query1 returns no results, the engine automatically triggers a re_search using query2 to avoid empty results.
After adding Named Entity Recognition, the actual query becomes:
query1=(default:'Yang Mi' AND ((default:'Nike') OR (default:'nike')) AND default:'slim-fit' AND default:'dress' RANK default:'free shipping' RANK default:'same style')
query2=(((default:'Nike') OR (default:'nike')) AND default:'dress' RANK default:'slim-fit' RANK default:'free shipping' RANK default:'same style' RANK default:'Yang Mi')
// Note: NER identifies the following entities: Yang Mi (person), same style (suffix), Nike/nike (brand), slim-fit (style element), dress (category), free shipping (marketing service). High-importance entities are retained for retrieval; low-importance terms affect only sorting, not retrieval. If query1 returns no results, the engine automatically triggers a re_search using query2 to avoid empty results.
Console configuration steps
Step 1: In the OpenSearch console, go to Recall Configuration > Query Analysis and click Create. From the navigation pane on the left, choose Recall Configuration > Query Analysis to open the query analysis list page. Click the Create button in the upper-right corner to create a new query analysis rule. Step 2: Configure the rule name, index scope, industry type, and selected features (multiple selections allowed). In the Add Rule dialog box, enter a rule name (for example, test_qp), set the index scope to default, select General as the industry type, and check Spelling Correction, Term Weight, and Synonym. In the term weight settings, select System Built-in Dictionary, then click OK. Step 3: After creation, run a search effectiveness test. Once validated, set the rule as default to apply it to live queries. Search test: After creation, the query analysis list shows a new rule named test_qp of type Custom, with search field default, industry type General, and Spelling Correction, Term Weight, and Synonym enabled. Click the Search Test link in the Actions column to verify the query analysis effect. Switch to index view and set as default: On the Query Analysis page, click Query Analysis View in the upper-right corner to switch to Index View. This displays all query analysis rules associated with the index and their features (stop word filtering, spelling correction, term weight, synonym, etc.). In the rule list, click Set as Default Query Analysis next to a rule to make it the default for that index. Click the Create button in the upper-right corner to add a new query analysis rule.