云数据库 GaussDB-Simple词典:操作步骤

时间:2023-11-01 16:18:33

操作步骤

  1. 创建Simple词典。

    1234
    gaussdb=# CREATE TEXT SEARCH DICTIONARY public.simple_dict (     TEMPLATE = pg_catalog.simple,     STOPWORDS = english);

    其中,停用词表文件全名为english.stop。关于创建simple词典的语法和更多参数,请参见CREATE TEXT SEARCH DICTIONARY

  2. 使用Simple词典。

     1 2 3 4 5 6 7 8 91011
    gaussdb=# SELECT ts_lexize('public.simple_dict','YeS'); ts_lexize ----------- {yes}(1 row)gaussdb=# SELECT ts_lexize('public.simple_dict','The'); ts_lexize ----------- {}(1 row)

  3. 设置参数ACCEPT=false,使Simple词典返回NULL,而不是返回非停用词的小写形式。

     1 2 3 4 5 6 7 8 910111213
    gaussdb=# ALTER TEXT SEARCH DICTIONARY public.simple_dict ( Accept = false );ALTER TEXT SEARCH DICTIONARYgaussdb=# SELECT ts_lexize('public.simple_dict','YeS'); ts_lexize -----------(1 row)gaussdb=# SELECT ts_lexize('public.simple_dict','The'); ts_lexize ----------- {}(1 row)

support.huaweicloud.com/centralized-devg-v3-opengauss/gaussdb-12-0445.html