Documentation
(C) IBM Corp. 1996, 1999

Text Extender: Administration and Programming


Maintaining text indexes

These are the maintenance tasks:

You can run these tasks at any time and in any sequence.

Updating an index

Summary

When
When an index must be updated immediately without waiting for periodic indexing to occur. (See Enabling a text column and Changing the settings of an index for information about periodic indexing.)

Command
UPDATE INDEX

Authorization
ALTER, SELECT, UPDATE on the table

This example updates the index for a common-index table:

     db2tx "UPDATE INDEX db2tx.sample"

This example updates the index for a column of a multi-index table:

     db2tx "UPDATE INDEX db2tx.sample HANDLE commenthandle"

Use this command to update the index immediately, without waiting for the next periodic indexing to take place automatically. This is useful when you have added several text documents to a database and want to search them immediately.

Text Extender indexes the text documents in this column (or all columns in the table) that have been inserted or changed, and removes from the index the terms from documents that have been deleted. The log table associated with the index contains information about which documents have been inserted, updated, and deleted.

Updating an index for external files

A log table does not automatically contain information about changes to any external files that you may have indexed (see Enabling external text files), such as replacing a document by a newer version having the same absolute path name. Updates occurring on such files cannot be monitored by Text Extender in log tables because the updates do not occur within the scope of DB2 UDB .

To have updates on external files reflected in a Text Extender index, you can do the following:

  1. Force a "change" entry to be placed in the log table by issuing an update statement on the corresponding handle column that effectively does nothing:
        UPDATE table
        SET    filehandlecol = filehandlecol
        WHERE  DB2TX.FILE(filehandlecol) = filename
    

    where filename is the absolute path name of the external file that was updated.

  2. Run UPDATE INDEX to bring the index up to date, including the change made to the external file.

Changing the settings of an index

Summary

When
When the update frequency of an index has to be changed.

Command
CHANGE INDEX SETTINGS

Authorization
ALTER, SELECT, UPDATE on the table

Use this command to change the update frequency of an index.

Update frequency

See Setting the frequency of index updates for more information. If you do not specify an update frequency, the current settings are left unchanged.

Use the UPDATEINDEX keyword to determine whether the indexing of the text documents begins immediately, or when periodic indexing is next scheduled. If you do not use this keyword, the current setting is left unchanged.

Examples

To change the update frequency for the index so that it is updated at 12:00 or 15:00, on Monday to Friday, if there is a minimum of 100 text documents queued:

     db2tx "CHANGE INDEX SETTINGS db2tx.sample
                       HANDLE     commenthandle
                       UPDATEFREQ min(100) d(1,2,3,4,5) h(12,15) m(00)"

To stop the periodic updating of an index:

     db2tx "CHANGE INDEX SETTINGS db2tx.sample
                       HANDLE     commenthandle
                       UPDATEFREQ none"

Resetting the index status

Summary

When
When an index can no longer be searched or updated.

Command
RESET INDEX STATUS

Authorization
None

Some situations can occur that prevent you from searching in an index, or from updating it. Displaying the status of an index describes how to determine if one of these events has occurred. RESET INDEX STATUS reactivates the index so that you can use it again.

This example resets the index status for the index of a common-index table:

     db2tx "RESET INDEX STATUS db2tx.sample"

The syntax lets you reset the index status for a particular text column. This example resets the index status for the index of a multi-index table column:

     db2tx "RESET INDEX STATUS db2tx.sample HANDLE commenthandle"

Deleting index events

Summary

When
When you no longer need the messages in an index's log table.

Command
DELETE INDEX EVENTS

Authorization
None

If something prevents you from searching in an index, or from updating it, or if a document cannot be indexed, this is known as an indexing event. Information about indexing events is stored in the index's log table. It can help you determine the cause of the problem. When you no longer need these messages, you can delete them.

This example deletes messages from the index of a common-index table:

     db2tx "DELETE INDEX EVENTS db2tx.sample"

The syntax also lets you delete indexing events for a particular text column. This example deletes the messages for the index of a multi-index table column:

     db2tx "DELETE INDEX EVENTS db2tx.sample HANDLE commenthandle"

Reorganizing an index

Summary

When
When GET INDEX STATUS indicates that an index should be manually reorganized.

Command
REORGANIZE INDEX

Authorization
None

If a text column is often updated, searching the index can become inefficient. To make searching efficient again, the index has to be reorganized. Although Text Extender recognizes when an index needs to reorganized and does so in the background automatically, there may be situations that require an index to be reorganized manually using REORGANIZE INDEX. You can use the command GET INDEX STATUS to find out if an index needs to be reorganized.

Although searches can be made on the index while REORGANIZE INDEX is running, index updates cannot.

This example reorganizes the index of a common-index table:

     db2tx "REORGANIZE INDEX db2tx.sample"

This example reorganizes the index of a multi-index table column:

     db2tx "REORGANIZE INDEX db2tx.sample HANDLE commenthandle"


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]