All Products
Search
Document Center

OpenSearch:Query analysis in E-commerce scenarios

Last Updated:Feb 10, 2023

The intent judgment based on keywords in search queries determines whether the search results meet the requirements. Query Planner is a feature that is used to understand the query intent in OpenSearch. Query Planner performs various intelligent analyses on a search query, rewrites the search query, and then submits the search query to the search engine. Then, the search engine retrieves and sorts data based on the search query. You can use the following features for query analysis: synonym configuration, stop word filtering, spelling correction, term weight analysis, and category prediction. In addition, you can use the named entity recognition (NER) feature in E-commerce scenarios. The following sections describe the features of query analysis and show you how to perform query analysis in E-commerce scenarios.

Stop word filtering

Meaningless words in search queries are filtered out based on the built-in stop word dictionary. Meaningless words are the words that appear at a high frequency but do not affect the search results, such as punctuation marks and modal particles.

Spelling correction

If the search queries that you entered contain spelling errors, the search results may not meet expectations or even no search results may be returned. To resolve the issue, OpenSearch checks the spelling of the search queries that you entered. The spelling correction feature in the query analysis feature of OpenSearch corrects the spelling errors that may be contained in a search query and produces a new search query with errors corrected. Then, OpenSearch determines whether to use the new search query with errors corrected to conduct a search based on the credibility of the spelling correction.

Term weight analysis

The term weight analysis feature evaluates the importance of each term in search queries and quantifies the evaluated importance as a weight. OpenSearch may not use low-importance terms to retrieve documents. This helps increase the number of documents that are retrieved. If the search queries that you entered contain low-importance terms and these terms are involved in the document retrieval process, only a small number of documents may be retrieved based on the search queries.

Synonym configuration

The search queries that you entered may have synonyms that carry the same meaning. For example, when you search for Apple phone, the content that is related to iPhone can also be retrieved and displayed in the search results. In real life, many synonyms that carry the same meaning may exist. A single search query that you entered may not reflect all its synonyms. The capabilities to identify synonyms and conduct searches based on the synonyms are critical to increasing the retrieval rate. The synonym configuration feature of OpenSearch retrieves documents based on the synonyms of search queries. This increases the number of documents that are retrieved.

NER

The NER feature recognizes semantic entities with specific meanings in a search query. The query analysis feature rewrites query clauses based on the weights of identified entity categories to ensure that the retrieved documents meet your expectations. OpenSearch rewrites query clauses based on the priorities of entities. Entities with higher priorities are used to retrieve documents, whereas entities with lower priorities do not affect retrievals but affect sorting.

Example of performing query analysis in E-commerce scenarios

For example, the following search query is used: Yang Mi Same-style Nike Slim Drasses Delivery-free.. The following example shows the query clause on which no query analysis is performed:

query=(default:'Yang Mi' AND default:'Same-style' AND default:'Nike' AND default:'Slim' AND default:'Dr' AND default:'ass' AND default:'es' AND default:'Delivery-free' AND default:'.')

After stop word filtering, the following query clause is obtained:

query=(default:'Yang Mi' AND default:'Same-style' AND default:'Nike' AND default:'Slim' AND default:'Dr' AND default:'ass' AND default:'es' AND default:'Delivery-free')
// After stop word filtering, the punctuation mark in the search query is filtered out.

After spelling correction, the following query clause is obtained:

query=(default:'Yang Mi' AND default:'Same-style' AND default:'Nike' AND default:'Slim' AND default:'Dresses' AND default:'Delivery-free')
// In this example, the term "Drasses" with a spelling error in the search query is corrected.

After term weight analysis, the following query clause is obtained:

query1=(default:'Yang Mi' AND default:'Same-style' AND default:'Nike' AND default:'Slim' AND default:'Dresses' RANK default:'Delivery-free')
query2=(default:'Yang Mi' RANK default:'Slim' RANK default:'Delivery-free' RANK default:'Same-style' RANK default:'Nike' RANK default:'Dresses')
// After term weight analysis, the term "Delivery-free" with a lower weight is not involved in the retrieval process. If no result is returned based on query1, the search engine automatically triggers searches again and returns results based on query2. This way, results can be returned.

After synonym configuration, the following query clause is obtained:

query1=(default:'Yang Mi' AND default:'Same-style' AND ((default:'Nike') OR (default:'nike')) AND default:'Slim' AND default:'Dresses' RANK default:'Delivery-free')
query2=(default:'Yang Mi' RANK ((default:'Nike') OR (default:'nike')) RANK default:'Slim' RANK default:'Delivery-free' RANK default:'Same-style' RANK default:'Dresses')
// In this example, "nike" is added as a synonym for "Nike" after synonym configuration. If no result is returned based on query1, the search engine automatically triggers searches again and returns results based on query2. This way, results can be returned.

After NER, the following query clause is obtained:

query1=(default:'Yang Mi' AND ((default:'Nike') OR (default:'nike')) AND default:'Slim' AND default:'Dresses' RANK default:'Delivery-free' RANK default:'Same-style')
query2=(((default:'Nike') OR (default:'nike')) AND default:'Dresses' RANK default:'Slim' RANK default:'Delivery-free' RANK default:'Same-style' RANK default:'Yang Mi')
// The following NER result is obtained: Yang Mi (name) Same-style (suffix) Nike or nike (brand) Slim (style element) Dresses (category) Delivery-free (marketing). 
Entities with higher priorities are used to retrieve documents, whereas entities with lower priorities do not affect retrievals but affect sorting. If no result is returned based on query1, 
the search engine automatically triggers searches again and returns results based on query2. This way, results can be returned.

Configure the query analysis feature in the console

Step 1: Log on to the OpenSearch console. In the left-side navigation pane, choose Search Algorithm Center > Retrieval Configuration. On the Retrieval Configuration page, click Query Analysis Rule Configuration in the left-side pane. On the Query Analysis Rule Configuration page, click Create to create a query analysis rule.imageStep 2: In the Create Rule panel, configure the parameters as required, such as the Rule Name, Index Range, Industry Type, and Enabled Features parameters. You can set the Enabled Features parameter to multiple values. imageStep 3: After you create the rule, perform a search test. After you confirm that the process of query analysis is correct, set the rule as the default rule and apply the rule to online queries. imageOn the Query Analysis Rule Configuration page, click Index Orientation and set the rule as the default rule.image