The intent judgment based on keywords in search queries determines whether the search results meet the requirements of users. Query Planner is a feature that is used to understand the query intent in OpenSearch. Query Planner performs various intelligent analysis 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. This topic describes the basic features that you can use for query analysis.
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 punctuations and modal particles.
If the search queries entered by users 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 entered by users. 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 quantitates 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 entered by users 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.
The search queries entered by users may have synonyms that carry the same meaning as the search queries. For example, when a user searches for Apple phone, the content that is related to iPhone can also be retrieved and displayed in the search results. A single search query entered by a user 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 synonyms for search queries that users enter. This increases the number of documents that are retrieved.
Search query rewriting
The search query rewriting feature uses the AND or OR logical operator to specify how the results are retrieved for a search query based on the query terms. Note: Term weight or entity recognition can affect the analysis results of terms that are used to retrieve data. Example: The original search query is "Nike sports shoes", and the query is broken into "Nike/sports/shoes."
If the AND logical operator is used, the query is rewritten as the following string:
(default:'Nike' AND default:'sports' AND default:'shoes')
If the OR logical operator is used, the query is rewritten as the following string:
(default:'Nike' OR default:'sports' OR default:'shoes')
Enable the search query rewriting feature When you create or edit a query analysis rule, select AND or OR from the Query rewrite strategy drop-down list.
Query analysis based on multiple rules
In a query request, you can specify multiple query analysis rules by setting the qp parameter in the format of
qp=qpName1[,qpName2]. Take note of the following limits when you set this parameter. Assume that you two indexes, which are index_1 and index_2, and two query analyzers, which are qp_1 and qp_2.
Case 1: The index_1 index is bound to the qp_1 query analyzer. The index_2 is bound to the qp_2 query analyzer.
# Query statements index_1:'xxx' AND index_2:'xxx' & qp=qp_1,qp_2 # The query is valid. index_1:'xxx' & qp=qp_1,qp_2 # The query is valid. index_2:'xxx' & qp=qp_1,qp_2 # The query is valid.
Case 2: The index_1 index is bound to the qp_1 query analyzer. The index_1 is bound to the qp_2 query analyzer.
# Query statements index_1:'xxx' & qp=qp_1,qp_2 # An error occurs. The error message "6601:Rewrite index used in multi qp chains" is returned. index_1:'xxx' & qp=qp_1 # The query is valid. index_2:'xxx' & qp=qp_2 # An error occurs. The error message "6606:No index need to process by QP"