Synonym lists

A synonym list consists of a root word and one or more words whose meaning is similar to the root word. Synonym lists are useful when you do not know the exact content of the text you are searching.

For example, suppose you want to search the description column of the videos table. You know that the description column contains references to videos that explain how to use multimedia document editors, but you are not sure if the editors are consistently described as multimedia document editors or multimedia text editors.

To perform this search, use a synonym list entry for the words document and text.

To instruct the search engine to use this word list when you perform a search, you use the MATCH_SYNONYM tuning parameter, as shown in the following example:
SELECT id, description from videos
    WHERE etx_contains(description, 
    Row('document', 'MATCH_SYNONYM = syn_list'));
You can maintain multiple synonym lists within a database. You specify which synonym list you want the search engine to use by setting MATCH_SYNONYM to the name of the synonym list. For example, to make syn_list2 the active synonym list while querying the videos table, execute the following statement:
SELECT id, description from videos
    WHERE etx_contains(description, 
    Row('document', 'MATCH_SYNONYM = syn_list2'));
To create a synonym list, first create an operating system file that contains root words with one or more synonyms, all on one line and separated by blanks. The lines of text must be separated by one blank line. For example, the following is a possible excerpt from an operating system file that will be used to create a synonym list:
quick speedy fast

monitor terminal CRT screen

In this example, quick and monitor are the root words. A word must be present as a root word for the synonyms of the word to be used. This means that if you want to search for synonyms of speedy, it must itself be listed as a root word; it is not enough to simply exist as a synonym for quick in the synonym list.

After you have created a synonym list file, you can make it known to the module by executing the etx_CreateSynWlst() routine.
Important: You must put a blank line between the lines of text in the synonym file. If you omit the blank lines, the DataBlade® module does not return an error, but it never finds any synonyms during a synonym matching search.
If you specify the MATCH_SYNONYM tuning parameter in the etx_contains() operator but do not set it equal to a value, etx_contains() refers to a default synonym list named etx_thesaurus. You can create your own etx_thesaurus synonym list from your own list of synonyms, or you can create one based on a list of standard English-language synonyms provided with your DataBlade module in the following location:
$INFORMIXDIR/extend/ETX.version/wordlist/etx_thesaurus.txt
where version is the current version of the DataBlade module installed on your computer.

If a query refers to the etx_thesaurus synonym list, and the list does not exist, the returns an error.

Important: The finds pattern matches of root words only, not of their synonyms.

For example, assume that you execute a text search and specify the PATTERN_ALL and MATCH_SYNONYM tuning parameters and that the specified synonym list contains the root word abandon with one synonym: surrender. The search returns documents that contain the word abanden, a pattern match of the root word abandon, but does not return documents that contain the word surender, a pattern match of the synonym surrender.