↑↓ 选择↵ 打开⌫ 切换范围完整搜索

PG.CENTER 连接 PostgreSQL 文档、百科与生态知识。由 Pigsty 维护。

Wiki / 全文检索组件

romanian

Text search configuration romanian.

当前阅读 PG 18·选择有来源记录的版本

此版本暂无所选语言的定义,以下显示原始英文内容。

Configuration
romanian
Parser
default
aliases
未知
manual path
/docs/18/textsearch-configuration.html
signature
未知

版本定义 PG 18

12.7. Configuration Example

A text search configuration specifies all options necessary to transform a document into a tsvector: the parser to use to break text into tokens, and the dictionaries to use to transform each token into a lexeme. Every call of to_tsvector or to_tsquery needs a text search configuration to perform its processing. The configuration parameter default_text_search_config specifies the name of the default configuration, which is the one used by text search functions if an explicit configuration parameter is omitted. It can be set in postgresql.conf, or set for an individual session using the SET command.

Several predefined text search configurations are available, and you can create custom configurations easily. To facilitate management of text search objects, a set of SQL commands is available, and there are several psql commands that display information about text search objects (Section 12.10).

As an example we will create a configuration pg, starting by duplicating the built-in english configuration:

CREATE TEXT SEARCH CONFIGURATION public.pg ( COPY = pg_catalog.english );

We will use a PostgreSQL-specific synonym list and store it in $SHAREDIR/tsearch_data/pg_dict.syn. The file contents look like:

postgres    pg
pgsql       pg
postgresql  pg

We define the synonym dictionary like this:

CREATE TEXT SEARCH DICTIONARY pg_dict (
    TEMPLATE = synonym,
    SYNONYMS = pg_dict
);

Next we register the Ispell dictionary english_ispell, which has its own configuration files:

CREATE TEXT SEARCH DICTIONARY english_ispell (
    TEMPLATE = ispell,
    DictFile = english,
    AffFile = english,
    StopWords = english
);

Now we can set up the mappings for words in configuration pg:

ALTER TEXT SEARCH CONFIGURATION pg
    ALTER MAPPING FOR asciiword, asciihword, hword_asciipart,
                      word, hword, hword_part
    WITH pg_dict, english_ispell, english_stem;

We choose not to index or search some token types that the built-in configuration does handle:

ALTER TEXT SEARCH CONFIGURATION pg
    DROP MAPPING FOR email, url, url_path, sfloat, float;

Now we can test our configuration:

SELECT * FROM ts_debug('public.pg', '
PostgreSQL, the highly scalable, SQL compliant, open source object-relational
database management system, is now undergoing beta testing of the next
version of our software.
');

The next step is to set the session to use the new configuration, which was created in the public schema:

=> \dF
   List of text search configurations
 Schema  | Name | Description
---------+------+-------------
 public  | pg   |

SET default_text_search_config = 'public.pg';
SET

SHOW default_text_search_config;
 default_text_search_config
----------------------------
 public.pg

Token-to-dictionary mappings

Token typeOrderDictionary
email1simple
url1simple
url_path1simple
host1simple
file1simple
version1simple
sfloat1simple
float1simple
int1simple
uint1simple
numword1simple
hword_numpart1simple
numhword1simple
asciiword1romanian_stem
hword_asciipart1romanian_stem
asciihword1romanian_stem
word1romanian_stem
hword_part1romanian_stem
hword1romanian_stem

比较版本

完整来源事实

attributes

{"configuration":"romanian","parser":"default"}

mappings

map[dictionary:simple sequence:1 token:email], map[dictionary:simple sequence:1 token:url], map[dictionary:simple sequence:1 token:url_path], map[dictionary:simple sequence:1 token:host], map[dictionary:simple sequence:1 token:file], map[dictionary:simple sequence:1 token:version], map[dictionary:simple sequence:1 token:sfloat], map[dictionary:simple sequence:1 token:float], map[dictionary:simple sequence:1 token:int], map[dictionary:simple sequence:1 token:uint], map[dictionary:simple sequence:1 token:numword], map[dictionary:simple sequence:1 token:hword_numpart], map[dictionary:simple sequence:1 token:numhword], map[dictionary:romanian_stem sequence:1 token:asciiword], map[dictionary:romanian_stem sequence:1 token:hword_asciipart], map[dictionary:romanian_stem sequence:1 token:asciihword], map[dictionary:romanian_stem sequence:1 token:word], map[dictionary:romanian_stem sequence:1 token:hword_part], map[dictionary:romanian_stem sequence:1 token:hword]

来源引用

完整定义与证据 JSON

定义来源

center · PostgreSQL 18 · 555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f

正文语言: en · 555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f