Postgresql 中文操作指南

CREATE TEXT SEARCH TEMPLATE

CREATE TEXT SEARCH TEMPLATE — 定义一个新的文本搜索模板

CREATE TEXT SEARCH TEMPLATE — define a new text search template

Synopsis

CREATE TEXT SEARCH TEMPLATE name (
    [ INIT = init_function , ]
    LEXIZE = lexize_function
)

Description

CREATE TEXT SEARCH TEMPLATE 创建一个新的文本搜索模板。文本搜索模板定义了实现文本搜索词典的函数。模板本身并无用处,但必须实例化为字典才能使用。该字典通常指定要给模板函数的参数。

CREATE TEXT SEARCH TEMPLATE creates a new text search template. Text search templates define the functions that implement text search dictionaries. A template is not useful by itself, but must be instantiated as a dictionary to be used. The dictionary typically specifies parameters to be given to the template functions.

如果给出了架构名称,则在指定的架构中创建文本搜索模板。否则,它将创建在当前架构中。

If a schema name is given then the text search template is created in the specified schema. Otherwise it is created in the current schema.

您必须是超级用户才能使用 CREATE TEXT SEARCH TEMPLATE 。此限制是由于错误的文本搜索模板定义可能会混淆甚至使服务器崩溃。将模板与字典分开的目的是,模板封装了定义字典的“不安全”方面。定义字典时可以设置的参数对于无特权的用户设置是安全的,因此创建字典不需要是特权操作。

You must be a superuser to use CREATE TEXT SEARCH TEMPLATE. This restriction is made because an erroneous text search template definition could confuse or even crash the server. The reason for separating templates from dictionaries is that a template encapsulates the “unsafe” aspects of defining a dictionary. The parameters that can be set when defining a dictionary are safe for unprivileged users to set, and so creating a dictionary need not be a privileged operation.

详情请参考 Chapter 12

Refer to Chapter 12 for further information.

Parameters

  • name

    • The name of the text search template to be created. The name can be schema-qualified.

  • init_function

    • The name of the init function for the template.

  • lexize_function

    • The name of the lexize function for the template.

如果需要,函数名称可以是架构限定的。不提供参数类型,因为每种类型的函数的参数列表都是预先确定的。需要 lexize 函数,但 init 函数是可选的。

The function names can be schema-qualified if necessary. Argument types are not given, since the argument list for each type of function is predetermined. The lexize function is required, but the init function is optional.

这些参数可以按任何顺序显示,而不只是上面显示的顺序。

The arguments can appear in any order, not only the one shown above.

Compatibility

SQL 标准中没有 CREATE TEXT SEARCH TEMPLATE 语句。

There is no CREATE TEXT SEARCH TEMPLATE statement in the SQL standard.