IDOL Community Component 12.13

# Enable Synonym Lists

To enable synonym lists, you must create a synonym file, and configure the IDOL Content component to use it.

When you configure a synonym list, Content uses it at index time to locate the synonyms, and it applies the synonyms at query time, when you use the `Synonym` parameter.

Synonym lists might be useful if you want to use synonym matching for a small number of terms (100 or less). For longer lists of synonyms, it might affect the performance of indexing and query, and Micro Focus recommends that you use Query Manipulation Server instead.

NOTE: You must set up the synonym file before you index the data that you want to search.

The following sections describe how to set up and configure Content to use the synonym file:

- Create a Synonym File

- Configure the IDOL Content component to Use a Synonym File

- Perform Synonym Searches

- Update Synonym Files

## Create a Synonym File

The synonym file contains the synonyms that you want to apply in your queries.

To set up a synonym file

1. Create a text file and save it in the IDOL Content component `IDOL/content` directory.

2. Create a section for each language. The section name must be the name of a valid language type configured in the IDOL Content component (that is, a language and encoding).

   NOTE: You do not need to create a section for each encoding in the same language. Content uses the same synonyms for this language, in all encodings. For example, if you add an `[EnglishUTF8]` section, you do not also need to add an `[EnglishASCII]` section.

   For example:

       [EnglishUTF8]
       [GermanUTF8]

3. In each section, create a line for each list of synonyms. Use the same encoding that you specified in the section name. Content identifies all terms on the same line as synonyms. Separate each synonym term with commas. The individual synonym terms can contain spaces, but must not contain any punctuation.

   For example:

       [EnglishUTF8]
       cat,feline,grimalkin,moggy,mouser,puss,tabby
       dog,cur,hound,mans best friend,mongrel,mutt,pooch,puppy

       [GermanUTF8]
       Katze,Mietze,Mietzekatze,Mietzekater,Kater,Mulle,Kätzchen
       Hund,Wau Wau,Hündin,Töle,Kläffer,Hündchen,Welpe

4. Save the synonym file.

## Configure the IDOL Content component to Use a Synonym File

To configure Content to use a synonym file, you must configure a field process to specify the fields that you want to apply the synonym processing to. For these fields, Content processes and stores synonym information when you index documents, and retrieves the synonym information for synonym queries.

You must also configure the synonym job, which defines the location of the synonym file to use.

To configure Content to use a synonym file

1. Open the IDOL Content component configuration file in a text editor.

2. In the `[FieldProcessing]` section of the IDOL Content component configuration file, set up a synonym process. This process allows Content to determine the fields to which it must apply synonym settings. For example:

       [FieldProcessing]
       0=SynonymMatch

3. Create a section for the synonym process you listed.

   - Set `Property` to the name of the property configuration section for the process. The property that you create must not have the same name as the process.

   - Set `PropertyFieldCSVs` to the list of fields that you want to associate with the process. These fields must also be configured as `Index` fields.

     To identify the fields, use the format `/FieldName` to match root-level fields, `*/FieldName` to match all fields except root-level, or `/Path/FieldName` to match fields that the specified path points to.

   For example:

       [SynonymMatch]
       Property=ApplySynonymMatch
       PropertyFieldCSVs=*/DRETITLE,*/DRECONTENT

   In this example, Content processes synonyms for terms that occur in the `DRETITLE` and `DRECONTENT` fields. When you run a synonym search, Content searches for the query terms and their synonyms in these fields.

4. Create a section for the property. In this section, set `SynonymType` to the name of the synonym job that you want to apply to these fields.

       [ApplySynonymMatch]
       SynonymType=Synonym_job

5. Find the `[Synonym]` section of the IDOL Content component configuration file, or create one if it does not exist. In this section, list the name of the synonym job you want to create. You can set up multiple jobs. However, you normally require only one. For example:

       [Synonym]
       0=Synonym_job

6. Create a configuration section with the name of the synonym job.

   In this section, set `File` to the name of the text file that defines your synonym lists (see Create a Synonym File).

   For example:

       [Synonym_job]
       File=animals.txt

7. Set any other synonym settings that you want to use for this synonym job. For more information about the available settings, see the IDOL Content component Reference. For example:

       [Synonym_job]
       File=animals.txt
       MaxExpandLevel=1

8. Save and close the configuration file.

9. Restart the IDOL Content component for your changes to take effect.

## Perform Synonym Searches

After you create a synonym file and configure Content to use it, you can index your content. During the index process, Content processes the synonym rules and stores information about the synonyms in your index.

To run a synonym search, you send a `Query` action with the `Synonym` parameter set to `True`. For example:

    http://localhost:5552/action=Query&Text=Felix is a great mouser&Synonym=True

This query returns documents that match the term mouser, as well as documents that match any of the terms configured as synonyms for the term mouser.

NOTE: Content identifies and searches for synonyms only in the configured synonym fields. For any index fields that you do not define as synonym fields, Content searches only for the exact query terms.

Synonym queries return synonym links, which indicate internally the set of terms and phrases that a synonym corresponds to. You can use the `TermExpand` action, with the `Expansion` parameter set to `Synonym`, to expand these internal links to see what these term phrases are.

## Update Synonym Files

Content processes synonyms at index time. When you want to update or add a synonym in your synonym file, you must reindex your content for the modified synonyms to be available over all content. If you do not reindex, the synonym changes apply only to new documents.

© Copyright 2022 Micro Focus or one of its affiliates
Version 12.13 | Last updated October 2022

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to swpdl.idoldocsfeedback@microfocus.com.

We appreciate your feedback!

Product: IDOL IDOL Community Component 12.13

Topic Title: Enable Synonym Lists