Product DocsMenu

Creating or Modifying a Thesaurus XML File

The CES thesaurus is a list of related or equivalent words used to expand queries. It works by transparently adding expressions to the search.

If you are familiar with the structure of XML documents, editing the corresponding file manually is an effective way to populate the thesaurus. You can also add synonyms using the Administration Tool (see Adding Thesaurus Entries From the Administration Tool).

Important: XML syntax errors disable the thesaurus file and display the following message in the Thesaurus page (Index > Thesaurus): Object reference not set to an instance of an object.

The following table describes the valid tags and attributes that a thesaurus XML file contains.

Tag Attribute Description
mappings   Starting/closing thesaurus file tag.
mapping keyword=

Identifies the keyword to which synonyms are added.

Example: To add Coveo to the query CES, enter: <mapping keyword="CES">.

Enter only one keyword attribute per mapping tag.

You can however enter an expression (more than one word), in which case it is interpreted as an exact phrase, so the thesaurus entry is expanded only when users enter this exact phrase (same words in same order).

Example: <mapping keyword="Coveo Enterprise Search">.


Indicates the operator ( or or replace) used to add synonyms to the query.

Example: With robert being a synonym for bob, when you use or, a query for bob becomes bob OR robert. When you use replace, the same query becomes robert.

Note: To use the replace operator, the keyword must have only one synonym. The replace operator is incompatible with the bidirectional=true attribute.


Indicates whether the synonymy is reciprocal or not.

Example: With robert being a synonym for bob, when you use true, a query for bob becomes bob OR robert and a query for robert becomes robert OR bob. When you use false, a query for robert remains robert.

Note: The bidirectional=true attribute is incompatible with the type=replace attribute.

synonyms   Encloses all occurrences of synonym tags.
synonym value=

Identifies the expression to add as a synonym of the keyword.

Example: To add robert to the query bob, enter robert as synonym: <synonym value="robert"/>.

You can enter more than one synonym for a given keyword.

Note: You cannot use search prefixes or operators such as OR, AND, or NEAR (described in Search Prefixes and Operators) to define keyword and synonym tag values.

Creating an XML thesaurus file

  1. Using a text editor, create a new empty file.

  2. Start the thesaurus file content with the <mappings>opening tag.

  3. Enter each keyword-synonym mapping in the format illustrated by the following example.

    <mapping keyword="bob" type="or" bidirectional="false">
        <synonym value="robert"/>
  4. Close the thesaurus with the </mappings> closing tag.

  5. Save the file with a name of your choice and the xml extension. The recommended folder is [Index_Path]\Config.

    Example: C:\CES7\Config\MyThesaurus.xml

  6. Import the new thesaurus file in CES to activate it (see Importing a Thesaurus XML File in CES).

Modifying an existing XML thesaurus file:

  1. Using a text editor, open the existing thesaurus file.

    Example: C:\CES7\Config\DefaultThesaurus.xml

  2. Enter each keyword-synonym mapping in the following format.

    <mapping keyword="bob" type="or" bidirectional="false">
        <synonym value="robert"/>
  3. Save the file.

  4. Refresh the thesaurus (see Refreshing the Thesaurus).

People who viewed this topic also viewed