Customizing the Search Thesaurus XML

The search thesaurus allows administrators to configure synonyms of search terms, so that when one term is searched, its synonyms would also be returned. Thesaurus terms and their synonyms can be added, modified, and deleted in the Laserfiche Web Administration Console (see Viewing and Modifying the Search Thesaurus for details), but they can also be manually customized using search thesaurus XML.

The search thesaurus XML uses the same XML format as thesaurus terms exported in the Web Administration Console. (See Importing and Exporting Thesaurus Terms for more information). To customize your search thesaurus using the XML file, you can export your existing thesaurus and modify the resulting XML file, or you can create a new XML file.

Search Thesaurus XML

You can create a custom search thesaurus XML file by exporting one or more search terms from your thesaurus in the Web Administration Console and then modifying the resulting XML file, or by creating a new XML file using the Laserfiche thesaurus XML format. The XML file can have any name you choose.

The following code example would result in the creation of four thesaurus entries: "dog," "hound," "animal," and "poodle." Users performing searches for the word "dog" would also find documents containing "hound" and vice versa. When performing a search for the word "animal" they would also find documents containing the word "dog," but not vice versa, and when performing a search for the word "dog" they would also return documents containing the word "poodle," but not vice versa.

<?xml version="1.0" encoding="utf-8"?>
<ArrayOfThesaurus xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://laserfiche.com/namespaces/fts/v3">
     <Thesaurus>
          <Key>dog</Key>
          <Synonym>hound</Synonym>
          <Type>user-defined</Type>
          <Weight>1</Weight>
     </Thesaurus>
     <Thesaurus>
          <Key>dog</Key>
          <Synonym>poodle</Synonym>
          <Type>user-defined</Type>
          <Weight>1</Weight>
     </Thesaurus>
     <Thesaurus>
          <Key>hound</Key>
          <Synonym>dog</Synonym>
          <Type>user-defined</Type>
          <Weight>1</Weight>
     </Thesaurus>
     <Thesaurus>
          <Key>animal</Key>
          <Synonym>dog</Synonym>
          <Type>user-defined</Type>
          <Weight>1</Weight>
     </Thesaurus>
</ArrayOfThesaurus>

As in the example above, use the following elements and attributes to define thesaurus entries. All elements are required.

Element Definition Example
<ArrayOfThesaurus xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://laserfiche.com/namespaces/fts/v3"> The ArrayOfThesaurus element encloses all thesaurus terms.  
<Thesaurus> The Thesaurus element encloses a single thesaurus association.  
<Key>

The Key element encloses the parent term for a thesaurus association. When this term is searched, a term in the Synonym element will be returned in the search results. Multi-word phrases may be used.

Note: Each thesaurus association is a one-way relationship. When a Key term is searched, results with its associated Element terms will be returned, but not vice versa. To create a truly synonymous connection, both terms must be defined as Key elements with the appropriate Synonym element.

<Key>NASA</Key>
<Synonym> The Synonym element encloses the child term for a thesaurus association. When the Key term is searched, this term will be returned in the search results. Multi-word phrases may be used.

Note: Each thesaurus association is a one-way relationship. When a Key term is searched, results with its associated Element terms will be returned, but not vice versa. To create a truly synonymous connection, both terms must be defined as Key elements with the appropriate Synonym element.

   <Synonym>National Aeronautics and Space Agency</Synonym>
<Type>

The Type element encloses the type of the thesaurus term. Valid values are: 

  • user-defined
  • predefined

Predefined terms will be removed when the Clear Predefined button is selected in the Web Administration Console. User-defined terms will not. If you are using thesaurus XML to import third-party thesaurus data, you can define that data as predefined to easily remove it without clearing manually configured thesaurus entries. If you do not want your thesaurus values to be removed when the Clear Predefined button is selected, set the type to user-defined.

<Type>user-defined</Type>
<Weight> The Weight element encloses the search weight of the thesaurus term. Unless you are instructed to do otherwise for troubleshooting purposes, you should retain the default weights for exported predefined thesaurus entries, and set the weight of modified or new user-defined thesaurus entries to 1. <Weight>1</Weight>

Using the Customized Search Thesaurus XML

Once you have created or customized search thesaurus XML, you can apply it to your repository in one of two ways. You can import the XML in the Laserfiche Web Administration Console (see Importing and Exporting Thesaurus Terms), or you can use the setthesaurus command in the Laserfiche Search Engine Configuration Utility.