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.
For example, a user enters the following search query: OpenSearch good or not.
The original query clause is
query=default:'opensearch' AND default:'good or not' before it is rewritten by the term weight analysis feature.
After the original query clause is rewritten by the term weight analysis feature, the new query clause becomes
query=default:'opensearch' RANK default:'good or not'.
Then, OpenSearch retrieves all documents that contain the term opensearch.
1.Log on to the OpenSearch console. In the left-side navigation pane, choose Search Algorithm Center > Retrieval Configuration. On the Basic Configuration page, click Query Analysis Rule Management in the left-side pane.
2.On the Query Analysis Rule Management page, select an application name and the online or offline version of the application, and click Create.
3.In the Add Rule panel, enter a rule name, select indexes, select Word Weight, and then click OK.
4.After the rule is created, run a search test.
View the process of query analysis:
5.After you confirm that the process of query analysis is correct, switch to Index Orientation on the Query Analysis Rule Management page. Then, set the created query analysis rule as the default query analysis rule.
6.Check the default query analysis rule.
Intervention dictionaries for term weight analysis
The terms that are extracted from the same search query after query analysis may be of different weights in different business scenarios. The settings of term weights in the built-in dictionary may not meet your requirements. To resolve the issue, OpenSearch allows you to customize term weights. After you create an intervention dictionary for term weight analysis, you can specify the intervention dictionary when you create or modify a query analysis rule. This way, you can intervene in the analysis of term weights. For more information, see Intervention dictionaries for term weight analysis.