Feature overview
The stop word feature uses the built-in stop word dictionary of the system to filter out meaningless terms from queries. These terms are typically used very frequently but do not affect query results, such as punctuation marks and modal particles. In the following examples, Chinese characters are represented as ASCII Unicode escapes. Decode them into the actual Chinese characters before you enter them. For example, for the query "\u5954\u8dd1\u5427!\u5144\u5f1f" (a Chinese TV show title that means "Keep Running! Brothers"), the punctuation mark "!" is not used for retrieval after stop word processing. For the query "\u4f60\u5403\u996d\u4e86\u5417" (Chinese for "Have you eaten?"), the modal particle "\u5417" is not used for retrieval after stop word processing.
Procedure
1. Log on to the OpenSearch console. In the left-side navigation pane, choose Retrieval Configuration > Query Analysis Configuration. Select the application name and the application type (online or offline), and click Create.
2. Enter a rule name in the Rule Name field, select an index scope from the Index Scope drop-down list, and select an industry type from the Industry Type drop-down list. In the feature selection section, select Stop Words and click OK.
Note: If no intervention dictionary is configured, the default dictionary is used. If bad cases occur in your actual business scenarios, you can configure an intervention dictionary as described in the following section.
3. After the rule is created, you can click Search Test to test the search results:
Test results: On the Search Test page, select the application and the online application type. In the following example, Chinese characters are represented as ASCII Unicode escapes. Decode them into the actual Chinese characters before you enter them. In the query box, enter default:'\u6cb3\u5317\u7701' ("Hebei Province" in Chinese). In the parameter section, set qp to the query analysis rule that you created, such as test_ting. After you click Search, the information bar of the page shows that the actual query is (default:'\u6cb3\u5317') ("Hebei" in Chinese). This indicates that the stop word "\u7701" ("Province") is filtered out, and one matching result is returned.
View the query analysis process: The query analysis process shows that the original query \u6cb3\u5317\u7701 remains \u6cb3\u5317\u7701 after normalization, the tokenization result is \u6cb3\u5317/\u7701, \u7701 is removed after stop word filtering, and the final query rewriting result is (default:'\u6cb3\u5317').
4. After debugging is complete, switch to the Index View on the query analysis page and set the custom query analysis rule as the default query analysis rule. To do so, click Set as Default for the rule in the Index View.
5. The page after the custom query analysis rule is set as the default:
After the setting is complete, the [Default] label is displayed before the name of the query analysis rule, which indicates that the rule is set as the default query analysis rule.
Stop word intervention dictionaries
Stop words vary based on business scenarios. The built-in dictionary of the system may lack some stop words or contain incorrect stop words. Therefore, OpenSearch provides the intervention feature that allows you to customize stop words. You can intervene in the stop word feature by creating a stop word intervention dictionary and specifying the intervention dictionary in the stop word configuration of a query analysis rule. For more information about how to configure a stop word intervention dictionary, click here.