Hitachi

Hitachi Advanced Database Setup and Operation Guide


11.16.1 Preparing for synonym search operations

Before performing synonym search operations, perform the following preparatory tasks.

Organization of this subsection

(1) Considering defining text indexes

When you perform synonym search operations, performance improvement is expected if you use text indexes. Therefore, we recommend that you define text indexes for the columns in which text data (document data) is stored.

▪ Cases in which no effect can be expected even if text indexes are defined

If there are only a few types of characters in the text data, performance improvement cannot be expected even if text indexes are defined. For example, this case includes when the text data consists only of numbers.

Also, when you perform a synonym search operation, if you specify as the search-target character string a simple and short character string (such as a or 0), performance improvement cannot be expected even if text indexes are defined. In some cases, text indexes might not be used.

For details about the points to consider when defining text indexes, see 5.4.1  Points to consider in determining the columns to be defined for a text index.

▪ Relationship with correction search

Synonym search operations can be performed together with correction search operations. To perform synonym search and correction search operations at the same time, when you define a text index in the CREATE INDEX statement, specify CORRECTIONRULE (notation-correction-search text-index specification).

For details about correction search, see 2.17.1 Correction search.

You can select whether to apply correction search in the specification of the scalar function CONTAINS when you perform a synonym search operation. Therefore, if whether to apply correction search is uncertain in the preparation step, we recommend that you define text indexes that support correction search.

Important

If the character encoding used on the HADB server is Shift-JIS (if the value specified for the environment variable ADBLANG is SJIS), correction search operations cannot be performed.

Even if you do not define text indexes, you can perform synonym search and correction search operations at the same time. However, from the viewpoint of performance, we recommend that you define text indexes.

■ Relationship with word-context search

Synonym search operations can be performed together with word-context search operations. To perform synonym search and word-context search operations at the same time, when you define a text index in the CREATE INDEX statement, specify TEXT WORDCONTEXT for INDEXTYPE (define a text index for a word-context search).

For details about word-context search, see 2.17.4 Word-context search.

You can select whether to apply word-context search in the specification of the scalar function CONTAINS when you perform a synonym search operation. Therefore, if whether to apply word-context search is uncertain in the preparation step, we recommend that you define text indexes for word-context search.

Even if you do not define text indexes, you can perform synonym search and word-context search operations at the same time. However, from the viewpoint of performance, we recommend that you define text indexes.

(2) Defining text indexes

To define a text index, perform the following procedure.

Procedure:
  1. Execute the CREATE INDEX statement to define a text index.

  2. Execute the adbidxrebuild command to create index data for the text index.

(3) Estimating the size required for the directory for storing synonym dictionary files

If you execute the adbsyndict command (which registers synonym dictionaries), synonym dictionary files that store information about individual synonym dictionaries are created. Estimate the size required for the directory for storing these synonym dictionary files. For the approximate size required for the directory for storing synonym dictionary files, see 11.16.12 Checking the free space required for the directory for storing synonym dictionary files.

To estimate in detail the size required for the directory for storing synonym dictionary files, see the following parts of this manual:

The total size determined from the preceding estimation is the size required for the directory for storing the synonym dictionary files.

Important

If free space for the directory for storing synonym dictionary files is insufficient, you need to change the directory for storing synonym directory files. If you change the directory for storing synonym dictionary files, you need to reregister all synonym dictionaries. Therefore, estimate the size of the directory so that the disk (on which the directory is created) will have enough free space.

(4) Creating the directory for storing synonym dictionary files

Create the directory for storing synonym dictionary files. From the performance point of view, we recommend that you prepare a file system in which only the directory for storing synonym dictionary files is created.

When you create the directory for storing synonym dictionary files, note the following.

Note

When you back up a database, the directory for storing synonym dictionary files is also backed up. For details about the backup acquisition method, see 10.3 Backing up a database.

(5) Assigning permissions to the directory for storing synonym dictionary files

Use the following procedure to assign permissions to the directory for storing synonym dictionary files.

Procedure:
  1. To the directory for storing synonym dictionary files, assign the permissions that allow reading, writing, and execution by the HADB administrator.

  2. To all directories included in the path of the directory for storing synonym dictionary files, assign permissions that allow execution by the HADB administrator.

Example:

If the directory for storing synonym dictionary files is /HADB/syndict:

  • Read, write, and execution permissions must be assigned to /HADB/syndict.

  • Execution permission must be assigned to / and /HADB.

(6) Modifying the server definition

For the adb_syndict_storage_path operand in the server definition, specify the name of the directory for storing synonym dictionary files. For details about the adb_syndict_storage_path operand, see adb_syndict_storage_path in 7.2.8 Operands related to synonym search (set format).

If you specify a symbolic link to the storage directory for synonym dictionary files in the adb_syndict_storage_path operand, a check is performed to determine whether the absolute path name generated after the symbolic link is resolved conforms to the rules explained in (4) Creating the directory for storing synonym dictionary files.

Note

For details about the procedure for modifying the server definition, see 8.5.2 Modifying the server definition.

(7) Creating a synonym list definition file

Create a file in which a list of synonyms to be registered in a synonym dictionary is written. This file is called a synonym list definition file. When you perform a synonym search operation, the synonyms written in the synonym list definition file are retrieved in a batch.

▪ Specification example of a synonym list definition file
database,data bank,DB↓
application server,AP server↓

Legend: ↓: Line feed

When you create a synonym list definition file as in the preceding example, if you specify database, data bank, or DB as the search-target character string, all of database, data bank, and DB become the search-target character string.

If you specify application server or AP server as the search-target character string, both of application server and AP server become the search-target character string.

▪ Specification rules for a synonym list definition file
  • Individual synonyms are delimited by ,.

  • The synonyms subject to batch search are written on one line. A group of synonyms written on one line is called a synonym group. In the following example, two synonym groups are specified.

    [Figure]

    Note

    Only the basic specification rules for a synonym list definition file are explained here. For details about the specification rules for a synonym list definition file, see 11.16.15 Specification rules for a synonym list definition file.

This example assumes that the synonym list definition file is saved with the following file name:

Important

Be sure to save the synonym list definition file that you created here because it is used, for example, when a synonym is added to a synonym dictionary.

(8) Creating a dictionary creation file

Create a file in which information about synonym dictionaries is specified. This file is called a dictionary creation file. Specify the dictionary creation file that you create here, as the argument of an option of the adbsyndict command that is executed when synonym dictionaries are registered.

▪ Specification example of a dictionary creation file
Dictionary1,/home/adbmanager/dictionary1_synonym.txt,CORRECTIONRULE,terms related to DB and AP server↓

Legend: ↓: Line feed

Explanation:

The following four items are specified in a dictionary creation file. Specify individual items by delimiting with a comma (,).

  • First line:

    Specify a synonym dictionary name.

  • Second line:

    Specify the name of the synonym list definition file you created in (7) Creating a synonym list definition file.

  • Third line:

    Specify the correction search option. For the correction search option, specify whether to create a synonym dictionary that supports correction search. Specify either of the following:

    - CORRECTIONRULE: Specify this when you create a synonym dictionary that supports correction search.

    - CASESENSITIVE: Specify this when you create a synonym dictionary that does not support correction search.

  • Fourth line:

    Specify a comment for the synonym dictionary.

Note

Only the basic specification rules for a dictionary creation file are explained here. For details about the specification rules for a dictionary creation file, see 11.16.16 Specification rules for a dictionary creation file.

This example assumes that the dictionary creation file is saved with the following file name:

Important

Be sure to save the dictionary creation file that is created here because it is used, for example, when a synonym is added to a synonym dictionary.

(9) Registering a synonym dictionary

Execute the adbsyndict command to register a synonym dictionary.

Command execution example

adbsyndict -m /home/adbmanager/dictionary1_information.txt
Explanation:

In the -m option, specify the absolute path name of the dictionary creation file you created in (8) Creating a dictionary creation file.

Note
  • When registration of synonym dictionaries is completed, the KFAA51509-I message is output. (As many messages as the synonym dictionaries for which registration is completed are output.) Identify the synonym dictionary names in the message, and confirm that registration of the synonym dictionaries is completed.

  • If you execute the adbsyndict command, one or multiple synonym dictionary files are created. If a synonym dictionary supports correction search, three synonym dictionary files are created. If a synonym dictionary does not support correction search, only one synonym dictionary file is created.

  • Do not delete or update the synonym dictionary files created in the directory for storing synonym dictionary files by using a method other than the adbsyndict command.

(10) Making a backup of the directory for storing synonym dictionary files

In case a failure occurs in a synonym dictionary file, make a backup of the directory for storing synonym dictionary files. If a failure occurs in a synonym dictionary file when you have not made a backup, you need to re-create the synonym dictionary file by using the adbsyndict command.

The directory for storing synonym dictionary files is the directory specified for the adb_syndict_storage_path operand in the server definition.