Sybase Technical Library - Product Manuals Home
[Search Forms] [Previous Section with Hits] [Next Section with Hits] [Clear Search] Expand Search

Using Filters on Text That Contains
Tags [Table of Contents] Creating Topics (Enhanced
Version Only)

Full-Text Specialty Data Store User's Guide

[-] Chapter 4 Setting Up Verity Functions
[-] Creating a Custom Thesaurus (Enhanced Version Only)

Creating a Custom Thesaurus (Enhanced Version Only)

The Verity thesaurus operator expands a search to include the specified word and its synonyms (for information on using the thesaurus operator, see "thesaurus"). In the Enhanced version of the Full-Text Search engine, you can create a custom thesaurus that contains application-specific synonyms to use in place of the default thesaurus.

For example, the default English language thesaurus contains these words as synonyms for "money": "cash," "currency," "lucre," "wampum," and "greenbacks." You can create a custom thesaurus that contains a different set of synonyms for "money"; for example, such as: "bid," "tokens," "credit," "asset," and "verbal offer."

To create a custom thesaurus, follow these steps:

  1. Make a list of the synonyms that you will use with your application. It may help to examine the default thesaurus (see "Examining the Default Thesaurus (Optional)").

  2. Create a control file that contains the synonyms you are defining for your custom thesaurus (see "Creating the Control File").

  3. Create the custom thesaurus using the mksyd utility (see "Creating the Thesaurus"). This uses the control file as input.

  4. Replace the default thesaurus with your custom thesaurus (see "Replacing the Default Thesaurus with the Custom Thesaurus").

For more information on "Custom Thesaurus Support" and the mksyd utility, see the Verity Web site .

In the Enhanced version of Full-Text Search engine, two sample files illustrate how to set up and use a custom thesaurus:

These files are in the $SYBASE/$SYBASE_FTS/sample/scripts directory.

Examining the Default Thesaurus (Optional)

A control file contains all the synonym definitions for a thesaurus. To examine the default thesaurus, create its control file using the mksyd utility. Use the syntax:

mksyd -dump -syd $SYBASE/$SYBASE_FTS/verity/common/vdkLanguage/vdk20.syd -f work_location/control_file.ctl

where:

Examine the control file (control_file.ctl) that it creates to view the default synonym lists.

Creating the Control File

Create a control file that contains the new synonyms for your custom thesaurus. The control file is an ASCII text file in a structured format. Using a text editor (such as vi or emacs), either:

Control File Syntax

The control file contains synonym list definitions in a synonyms: statement. For example, the following is a control file named colors.ctl:

$control: 1
synonyms:
{
list: "red, ruby, scarlet, fuchsia,\
magenta" 
list: "electric blue <or> azure"
/keys = "lapis"
}
$$

The synonyms: statement includes:

For more complex examples of control files, see the Verity Web site.

Creating the Thesaurus

The mksyd utility creates the custom thesaurus using a control file as input. It is located in:

$SYBASE/$SYBASE_FTS/verity/bin

Run, or define an alias to run, mksyd from this bin directory. Create your custom thesaurus in any work directory.

The mksyd syntax for creating a custom thesaurus is:

 mksyd -f control_file.ctl -syd custom_thesaurus.syd

where:

For example, to execute the mksyd utility reading the sample control file defined above, and directing output to a work directory, use the syntax:

mksyd -f /usr/u/sybase/dba/thesaurus/colors.ctl -syd /usr/u/sybase/dba/thesaurus/custom.syd 

Replacing the Default Thesaurus with the Custom Thesaurus

The default thesaurus named vdk20.syd is located in:

$SYBASE/$SYBASE_FTS/verity/common/vdkLanguage

where vdkLanguage is the value of the vdkLanguage configuration parameter (for example, the English directory is $SYBASE/$SYBASE_FTS/verity/common/english). Each application and user reading from this location at runtime uses this thesaurus. To replace it with your custom thesaurus, follow these steps:

  1. Back up the default thesaurus before replacing it with the custom thesaurus. For example:

    mv /$SYBASE/$SYBASE_FTS/verity/common/english/vdk20.syd default.syd

  2. Replace the vdk20.syd file with your custom thesaurus. For example:

    cp custom.syd /$SYBASE/$SYBASE_FTS/verity/common/english/vdk20.syd

  3. Restart your Full-Text Search engine; no configuration file changes are required. The thesaurus is read from this location when the Full-Text Search engine is started, not when a query is executed.

Queries using the thesaurus operator will now use the custom thesaurus.


Using Filters on Text That Contains
Tags [Table of Contents] Creating Topics (Enhanced
Version Only)