CREATE TEXT SEARCH DICTIONARY

Function

CREATE TEXT SEARCH DICTIONARY creates a full-text retrieval dictionary. A dictionary is used to identify and process particular words during full-text retrieval.

Dictionaries are created by using predefined templates (defined in the PG_TS_TEMPLATE system catalog). Five types of dictionaries can be created, Simple, Ispell, Synonym, Thesaurus, and Snowball. Each type of dictionaries is used to handle different tasks.

Precautions

Syntax

1
2
3
4
CREATE TEXT SEARCH DICTIONARY name (
    TEMPLATE = template
    [, option = value [, ... ]]
);

Parameter Description

Examples

Create an Ispell dictionary english_ispell (the dictionary definition file is from the open source dictionary):

Hard-coded or plaintext AK and SK are risky. For security purposes, encrypt your AK and SK and store them in the configuration file or environment variables.

1
2
3
4
5
6
7
8
DROP TEXT SEARCH DICTIONARY IF EXISTS english_ispell;
CREATE TEXT SEARCH DICTIONARY english_ispell (
    TEMPLATE = ispell,
    DictFile = english,
    AffFile = english,
    StopWords = english,
    FilePath = 'obs://bucket_name/path accesskey=ak secretkey=sk region=rg' 
);

Create an Snowball dictionary english_snowball (the dictionary definition file is from the open source dictionary):

Hard-coded or plaintext AK and SK are risky. For security purposes, encrypt your AK and SK and store them in the configuration file or environment variables.

DROP TEXT SEARCH DICTIONARY IF EXISTS english_snowball;
CREATE TEXT SEARCH DICTIONARY english_snowball (
    TEMPLATE = snowball,
    Language = english,
    StopWords = english,
    FilePath = 'obs://bucket_name/path accesskey=ak secretkey=sk region=rg'  
);

Helpful Links

ALTER TEXT SEARCH DICTIONARY, CREATE TEXT SEARCH DICTIONARY