This command enables a text column for use by Text Extender.
Authorization
You must have at least one of the following for the table:
ALTER privilege
SELECT privilege
UPDATE privilege.
>>-ENABLE TEXT COLUMN--table-name--text-column-name-------------> >-----+--------------------------+--HANDLE--handle-column-name--> '-FUNCTION--function-name--' >-----+-----------------------+---------------------------------> '-| text-information |--' >-----+----------------------------+----------------------------> '-| index-characteristics |--' >-----+----------------------------+----------------------------> '-UPDATEINDEX--+-UPDATE---+--' '-NOUPDATE-' >-----+------------------------------+--------------------------> '-TABLESPACE--tablespace-name--' >-----+---------------------+---------------------------------->< '-COMMITCOUNT--count--' text-information |---+---------------+---+---------------------+-----------------> '-CCSID--ccsid--' '-LANGUAGE--language--' >-----+-----------------+---------------------------------------| '-FORMAT--format--' index-characteristics |---+-----------------------------------------------------------------+-> '-INDEXTYPE--+-PRECISE----+---+--------------------------------+--' +-LINGUISTIC-+ '-INDEXOPTION--+-CASE_ENABLED-+--' +-DUAL-------+ '-NORMALIZED---' '-NGRAM------' >----+--------------------------------------------------------------------------------+-> | .-,------------. | | V | | '-INDEXPROPERTY--SECTIONS_ENABLED--+-DOCUMENTMODEL--+---(-----modelname---+---)--' '-DOCUMENTMODELS-' >----+----------------------------------------+-----------------> '-UPDATEFREQ--+-NONE------------------+--' '-| update-frequency |--' >-----+-------------------------------------------------------------------------------+> +-DIRECTORY--directory----------------------------------------------------------+ | .--------------------------------------------------------------------------. | | | .-,---------------------. | | | V V | | | '----DIRECTORY--directory--ON--+-NODE--+---(-----node--+-----------+--+---)---+-' '-NODES-' '-TO--node--' >---------------------------------------------------------------| update-frequency |---MIN--(--mindocs--)--D---(--+-*------------+---)---H---------> | .-,-------. | | V | | '----0...6---+-' .-,---------. V | >----(--+-*-------------+---)---M---(-----0...59---+---)--------| | .-,--------. | | V | | '----0...23---+-'
Command parameters
For an Ngram index, the CCSID must be the same as the CCSID of the database. To find the default CCSID, use:
db2tx get text cfg
The installation default is the database CCSID.
If this keyword is not specified, the CCSID specified in the text configuration settings is used. Subsequent changes to the text configuration settings are ignored; the value used is the one that existed at the time the column was enabled, not the one that exists when indexing text documents.
For information about other CCSIDs that can be supported, see CCSIDs.
This keyword specifies the language once for the whole column. You can override this value for individually inserted text documents using the INIT_TEXT_HANDLE function in an INSERT statement.
If this keyword is not specified, the language specified in the text configuration settings is used. Subsequent changes to the text configuration settings are ignored; the value used is the one that existed at the time the column was enabled, not the one that exists when indexing text documents.
The supported languages are listed in Languages.
The document formats supported for structured documents are:
Documents having the format ASCII_SECTIONS cannot contain nested sections. (For information about nested sections, see Working with structured documents.) A start tag for a section is ended by the next start tag.
A sample document model file is provided for HTML documents. It contains a subset of the standard HTML definitions, which you can modify if required. HTML documents cannot contain nested sections.
The processing of XML documents includes Document Type Definition (DTD) evaluation. The model assigned to the document is checked against the DTD. If the tags defined in the document model file are not defined in the DTD, the document is not indexed. f no model has been defined for a recognized DTD, the document will not be indexed. XML documents can contain nested sections.
For these formats, you must specify the structure information in a document model file. See Working with structured documents. If the format TDS and INDEXPROPERTY SECTION_ENABLED are specified, it is assumed that the document format is ASCII_SECTIONS.
Tags that are not defined in the model file are indexed in the normal way, according to the index type.
This keyword specifies the format once for the whole column. You can override this value for individually inserted text documents using the INIT_TEXT_HANDLE function in an INSERT statement.
If this keyword is not specified, the format specified in the text configuration settings is used. Subsequent changes to the text configuration settings are ignored; the value used is the one that existed at the time the column was enabled, not the one that exists when indexing text documents.
If you do not specify the INDEXTYPE keyword, the value in the text configuration settings is used.
The dual index type cannot be used to take advantage of document structure.
Documents in XML format are not supported for Ngram indexes.
SECTIONS_ENABLED specifies that the selected index type can contain information about the document structure.
DOCUMENTMODEL/DOCUMENTMODELS model-name specifies the model or models to be associated as default for the documents to be indexed. A model name must be specified if the index property SECTIONS_ENABLED is used. If a list of models is specified, the first model is used as the default model for the index. The default model is used during indexing if the document has no reference to a model, or if no model is specified during search.
The characters that can be used for the model name are a-z, A-Z, and 0-9.
The specified model name must correspond to a model definition in the model definition file desmodel.ini.
To change the model or models associated with an index,
The syntax is described in Setting the frequency of index updates.
If you do not specify UPDATEFREQ, the default frequency specified in the text configuration settings is used.
Tip |
---|
If you have many tables, consider avoiding the use of the default values. By making individual update frequency settings for tables you can avoid indexing all the tables simultaneously and causing an unnecessarily prolonged load on your system resources. |
These update frequency settings are ignored if they have already been set for the whole table by ENABLE TEXT TABLE.
This is an existing directory on the system where the Text Extender server is running.
If you do not specify the DIRECTORY keyword, the value of the DIRECTORY setting in the text configuration settings is used.
This setting is ignored if it has already been set for the whole table by ENABLE TEXT TABLE.
If you are using partitioned databases, you can specify one common index path name for all nodes, or for a range of nodes, or different index directory paths for each node.
If you do not specify this keyword, the value in the text configuration settings is taken.
Usage notes
This command adds a handle column to the specified DB2 table. Each handle column is associated with a text column, and is used by Text Extender's UDFs.
If this table has not already been enabled to create a common index, an index is created that is associated with this text column.
Also, a log table is created in the database. The log table is used to record changes to the text column, that is inserts, updates, and deletions. Insert, update, and delete triggers are defined for the text column to keep the log table up to date automatically.
If the text column that you are enabling belongs to a table that is part of a multiple-node nodegroup, the index directory that you specify must be available on all physical nodes. If you use the default directory specified in the text configuration, make sure that the path is available on all nodes of the nodegroup. If this is not convenient, you can specify a specific path for each node in the ENABLE TEXT COLUMN command.
If you change the node configuration of a nodegroup that contains a table that is enabled for Text Extender, you must reindex the table.
Tip |
---|
If you run out of log space in this step, see Enabling a text column in a large table for possible solutions. |