All Products
Search
Document Center

Synonym configuration

Last Updated: Sep 09, 2021

Overview

The search queries entered by users may have synonyms that carry the same meaning as the search queries. For example, when users search for Apple phone, you may want the search results to contain the entries that hit either Apple phone or iPhone. In real life, we use many synonyms that carry the same meaning. 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. For example, drink and beverage are synonyms. If the synonym configuration feature is disabled, when users search for drink, documents that hit beverage are not retrieved in the search results. If the synonym configuration feature is enabled, documents that hit beverage are retrieved.

Procedure

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.

1

2.On the Query Analysis Rule Management page, select an application name and the online or offline version of the application, and click Create.

2

3.In the Add Rule panel, enter a rule name, select indexes, select Synonym, and then click OK.

3

Note: If no intervention dictionary for synonym configuration is specified, the built-in dictionary for synonym configuration is used. If identified synonyms are invalid or synonyms are not identified based on the built-in dictionary, specify an intervention dictionary. For more information, see the "Intervention dictionaries for synonym configuration" section of this topic.

4.After the rule is created, run a search test.

4

View the process of query analysis:

4

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

6.Check the default query analysis rule.

7

Intervention dictionaries for synonym configuration

Synonyms vary with business scenarios. Specific synonyms may not exist in the built-in dictionary for synonym configuration, or the built-in dictionary may contain invalid synonyms. To resolve the issue, OpenSearch allows you to customize synonyms. After you create an intervention dictionary for synonym configuration, you can specify the intervention dictionary when you create or modify a query analysis rule. This way, you can intervene in synonym configuration. For more information, see Intervention dictionaries for synonym configuration.