The SYSTS_CREATE procedure creates a text search index for a text column by issuing the DB2® Text Search CREATE INDEX command on the database server. After you create and update a text search index, you can search the column data by using text search functions.
None
>>-SYSTS_CREATE--(--index_schema--,--index_name--,--------------> >--| text source |--,--| options |------------------------------> >--,--message_locale--,--message--)---------------------------->< text source |--+--------------+--table_name--(--| text column name |--)--,--| '-table_schema-' text column name |--+-column_name-----------------+------------------------------| '-function_name (column_name)-' options |--+-+------------------------------+----+----------------------| | '-| text default information |-' | +-+----------------------------+------+ | '-| update characteristics |-' | +-+---------------------+-------------+ | '-| storage options |-' | '-+---------------------------------+-' '-| index configuration options |-' text default information |--+---------------------+--+--------------------+--------------> '-CODEPAGE--code_page-' '-LANGUAGE--language-' >--+----------------+-------------------------------------------| '-FORMAT--format-' update characteristics |--+--------------------------------------------+---------------> '-UPDATE FREQUENCY--+-NONE-----------------+-' '-| update frequency |-' >--| incremental update characteristics |-----------------------| update frequency |--D-(-+-*------------+-)--H-(-+-*------------+-)---------------> | .-,--------. | | .-,--------. | | V | | | V | | '---integer1-+-' '---integer2-+-' .-,--------. V | >--M-(---integer3-+-)-------------------------------------------| incremental update characteristics |--+----------------------------+-------------------------------| '-UPDATE MINIMUM--minchanges-' storage options |--+---------------------------------+--------------------------> '-COLLECTION DIRECTORY--directory-' >--+-------------------------------------------+----------------| '-ADMINISTRATION TABLES IN--tablespace_name-' index configuration options |--+-----------------------------------------------+------------| | .-,----------------. | | V | | '-INDEX CONFIGURATION--(---| option value |-+-)-' option value |--+----------------------------------------------+-------------| +-COMMENT--text -------------------------------+ +-UPDATEAUTOCOMMIT--+-+--------------------+-+-+ | | '-commitcount_number-' | | | '-+------------+---------' | | '-commitsize-' | +-COMMITTYPE--committype-----------------------+ +-COMMITCYCLES--commitcycles-------------------+ +-INITIALMODE--initialmode---------------------+ +-LOGTYPE--ltype-------------------------------+ +-AUXLOG--auxlog_value-------------------------+ '-CJKSEGMENTATION -cjksegmentation_method------'
The schema is SYSPROC.
You can create only a single text search index for a column. The column_name argument is case-sensitive.
This option applies only to binary data types. That is, the column type or return type from a transformation function must be BLOB or BIT DATA.
The default format is taken from the SYSIBMTS.TSDEFAULTS view, from the row with the DEFAULTNAME column value of UPDATEFREQUENCY.
Specifies the directory in which the text search index collection is stored. You must specify the absolute path, where the maximum length of the absolute path name is 215 characters. The process owner of the instance service of the text search server must have read and write access to this directory.
The COLLECTION DIRECTORY option is supported only for an integrated text search server setup. For additional information about collection locations, review the usage notes.
Specifies the name of an existing non-temporary table space for the administration tables that are created for the index. By default, the table space of the base table for which you are creating the index is used.
This argument is required when you are creating a text index for a partitioned table or for tables in partitioned databases. For partitioned databases, the table space must be in the same partition group as the table space of the base table. The text index administration tables are distributed in the same manner as the corresponding base table.
Option | Value | Data type | Description |
---|---|---|---|
COMMENT | text | String value of fewer than 512 bytes | Adds a string comment to the REMARKS column in the DB2 Text Search SYSIBMTS.TSINDEXES catalog view. The comment is also used as the description of the collection. |
UPDATEAUTOCOMMIT | commitsize | String | Specifies the number of rows or number of hours after which a commit is run to preserve the previous work for either initial or incremental updates. If you specify the number of rows, after the number of updated documents reaches a COMMITCOUNT number, the server applies a commit. COMMITCOUNT counts the number of documents that are updated by using the primary key, not the number of staging table entries. If you specify the number of hours, the indexed data is committed after the specified number of hours is reached. The maximum number of hours is 24. For an initial update, the index update processes batches of documents from the base table. After the commitsize value is reached, update processing completes a commit operation, and the last processed key is saved in the staging table with the operational identifier 4. This key is used to restart update processing after a failure or after the completion of the specified number of commitcycles. If you specify a commitcycles value, the update mode is changed to incremental to initiate capturing changes by using the LOGTYPEBASIC option to create triggers on the text table. However, until the initial update is complete, log entries that were generated by documents that were not processed in a previous cycle are removed from the staging table. Using the UPDATEAUTOCOMMIT option for an initial text index update significantly increases execution time. For incremental updates, log entries that are processed are removed from the staging table with each interim commit. |
COMMITTYPE | committype | String | Specifies rows or hours for the UPDATEAUTOCOMMIT index configuration option. The default is rows. |
COMMITCYCLES | commitcycles | Integer | Specifies the number of commit cycles. The default is 0, meaning unlimited cycles. If you do not specify the number of cycles, the update operation uses as many cycles as required to finish the update processing, based on the batch size that you specify for the UPDATEAUTOCOMMIT option. You can use the COMMITCYCLES option with the UPDATEAUTOCOMMIT option with a committype value. |
INITIALMODE | initialmode | String | Specifies how the updates are processed. The possible values of the INITIALMODE index option are as follows:
|
LOGTYPE | ltype | String | Specifies whether triggers are added to populate the primary log table. The values are as follows:
Note: The default value of the LOGTYPE option is CUSTOM for text search indexes on nicknames.
|
AUXLOG | auxlog_value | String | Controls the creation of the additional log infrastructure to capture changes that are not recognized by a trigger. The default setting for range-partitioned tables is ON. You can change the default value in the default table by setting AuxLogNorm for non-range-partitioned tables and AuxLogPart for range-partitioned tables. For text search indexes on nicknames, only the OFF option can be enabled for the AUXLOG option to disable support for this index configuration option. You cannot change the auxiliary log infrastructure property for a text index after you create it. |
CJKSEGMENTATION | cjksegmentation_method | String | Specifies the segmentation method that applies to documents that use the Chinese, Japanese, or Korean language (zh_CN, zh_TW, ja_JP, or ko_KR locale set), including such documents when automatic language detection is enabled (when you specify the LANGUAGE parameter with the AUTO option). Supported values are:
The specified segmentation method is added to the SYSIBMTS.TSCONFIGURATION administrative view. You cannot change the method after creating the text index. |
INDEX CONFIGURATION (COMMENT 'Index on User''s Guide column')
CALL SYSPROC.SYSTS_CREATE('db2ts', 'myTextIndex',
'myUserSchema.myBaseTable (myTextColumn)', 'UPDATE MINIMUM 10',
'en_US', ?)
Value of output parameters
--------------------------
Parameter Name : MESSAGE
Parameter Value : Operation completed successfully.
Return Status = 0
CALL SYSPROC.SYSTS_CREATE('db2ts', 'myTextIndex2',
'myUserSchema.myBaseTable (myTextColumn)', '', 'en_US', ?)
SQL20427N An error occurred during a text search administration
procedure or command. The error message is "CIE00201 Text search
index "db2ts"."myTextIndex2" already exists. ".
If you create an index with the LANGUAGE parameter set to the AUTO option, you can specify the CJKSEGMENTATION option.
tigertail_MYTSDB_TS250517_0000
For
partitioned databases, a collection is created for each partition.
You can retrieve the collection names from the COLLECTIONNAME column
in the SYSIBMTS.TSCOLLECTIONNAMES view. select bookname from morphobooks
where contains (story, '军书','QUERYLANGUAGE=zh_CN') = 1
The AUXLOG option is supported for nicknames for data columns that support a materialized query table (MQT) with deferred refresh. It is not supported for views.
To create a text search index on a nickname, the nickname must be a non-relational flat file nickname. Non-relational XML nicknames are not supported.
For compatibility with an earlier version, you can specify the UPDATEAUTOCOMMIT index configuration option without type and cycles. This option is associated by default with the COMMITTYPE rows option and unrestricted cycles.
To override the configured values, you can specify the UPDATEAUTOCOMMIT, COMMITTYPE, and COMMITSIZE index configuration options for the UPDATE INDEX command. Values that you submit for a specific update operation are applied only once and are not persisted.
If you specify the INITIALMODE SKIP option, the text search index manager populates the index. Use this option to control the sequence in which data from the text table is initially processed.