Updated on 2024-10-14 GMT+08:00

ALTER TEXT SEARCH DICTIONARY

Function

ALTER TEXT SEARCH DICTIONARY modifies the definition of a full-text search dictionary, including its parameters, name, owner, and schema.

Precautions

  • Predefined dictionaries do not support the ALTER operations.
  • Only the owner of a dictionary or a system administrator can perform the ALTER operations.
  • After a dictionary is created or modified, any modification to the customized dictionary definition file in the filepath directory does not affect the dictionary in the database. To use these modifications in the database, run the ALTER TEXT SEARCH DICTIONARY statement to update the definition file of the corresponding dictionary.

Syntax

  • Modify the dictionary definition.
    1
    2
    3
    ALTER TEXT SEARCH DICTIONARY name (
        option [ = value ] [, ... ]
    );
    
  • Rename a dictionary.
    1
    ALTER TEXT SEARCH DICTIONARY name RENAME TO new_name;
    
  • Set the schema of the dictionary.
    1
    ALTER TEXT SEARCH DICTIONARY name SET SCHEMA new_schema;
    
  • Change the owner of the dictionary.
    1
    ALTER TEXT SEARCH DICTIONARY name OWNER TO new_owner;
    

Parameter Description

  • name

    Specifies the name of an existing dictionary. (If you do not specify a schema name, the dictionary in the current schema will be used.)

    Value range: an existing dictionary name

  • option

    Specifies the name of a parameter to be modified. Each type of dictionaries has a template containing their custom parameters. Parameters function in a way irrelevant to their setting sequence. For details about the parameters, see option.

    • The value of TEMPLATE in the dictionary cannot be changed.
    • To specify a dictionary, specify both the dictionary definition file path (FILEPATH) and the file name.
    • The name of a dictionary definition file can contain only lowercase letters, digits, and underscores (_).
  • value

    Specifies the new value of a parameter. If the equal sign (=) and value are omitted, the previous settings of the option are deleted and the default value is used.

    Value range: valid values defined by option.

  • new_name

    Specifies the new name of a dictionary.

    Value range: a string, which complies with the identifier naming convention. A value can contain a maximum of 63 characters.

  • new_owner

    Specifies the new owner of a dictionary.

    Value range: an existing username

  • new_schema

    Specifies the new schema of a dictionary.

    Value range: an existing schema

Examples

1
2
3
4
5
6
7
8
-- Modify the definition of stop words in Snowball dictionaries. Retain the values of other parameters.
openGauss=# ALTER TEXT SEARCH DICTIONARY my_dict ( StopWords = newrussian, FilePath = 'file:///home/dicts' );

-- Modify the Language parameter in Snowball dictionaries and delete the definition of stop words.
openGauss=# ALTER TEXT SEARCH DICTIONARY my_dict (Language = dutch, StopWords);

-- Update the dictionary definition and do not change any other content.
openGauss=# ALTER TEXT SEARCH DICTIONARY my_dict ( dummy );