↑↓ select↵ open⌫ change scopeOpen full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Wiki / SQL Commands

CREATE TEXT SEARCH PARSER

define a new text search parser

English manual coverage begins with PostgreSQL 6.4. Source history and runtime observations have their own recorded version boundaries.

Reading PG 18·Select a recorded version

anchor
SQL-CREATETSPARSER
file
sql-createtsparser.html
lang
en
name
CREATE TEXT SEARCH PARSER
purpose
define a new text search parser
purpose zh
定义一个新的文本检索解析器
sections same as
Unknown
slug
18
synopsis text
CREATE TEXT SEARCH PARSER name ( START = start_function , GETTOKEN = gettoken_function , END = end_function , LEXTYPES = lextypes_function [, HEADLINE = headline_function ] )

Syntax

CREATE TEXT SEARCH PARSER name (
START = start_function ,
GETTOKEN = gettoken_function ,
END = end_function ,
LEXTYPES = lextypes_function
[, HEADLINE = headline_function ]
)
Syntax diagrams

Read left to right. Branches are choices, bypasses are optional, loops repeat. Select an underlined parameter to open its rule.

CREATE TEXT SEARCH PARSER name ( START = start_function , GETTOKEN = gettoken_function , END = end_function , LEXTYPES = lextypes_function , HEADLINE = headline_function )

Definition PG 18

CREATE TEXT SEARCH PARSER name (
START = start_function ,
GETTOKEN = gettoken_function ,
END = end_function ,
LEXTYPES = lextypes_function
[, HEADLINE = headline_function ]
)

Description

CREATE TEXT SEARCH PARSER creates a new text search parser. A text search parser defines a method for splitting a text string into tokens and assigning types (categories) to the tokens. A parser is not particularly useful by itself, but must be bound into a text search configuration along with some text search dictionaries to be used for searching.

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

You must be a superuser to use CREATE TEXT SEARCH PARSER. (This restriction is made because an erroneous text search parser definition could confuse or even crash the server.)

Refer to Chapter 12 for further information.

Parameters

name

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

start_function

The name of the start function for the parser.

gettoken_function

The name of the get-next-token function for the parser.

end_function

The name of the end function for the parser.

lextypes_function

The name of the lextypes function for the parser (a function that returns information about the set of token types it produces).

headline_function

The name of the headline function for the parser (a function that summarizes a set of tokens).

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. All except the headline function are required.

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

Compatibility

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

See Also

ALTER TEXT SEARCH PARSER, DROP TEXT SEARCH PARSER

Compare versions

Complete source facts

synopsis html

CREATE TEXT SEARCH PARSER <em class="replaceable"><code>name</code></em> (
    START = <em class="replaceable"><code>start_function</code></em> ,
    GETTOKEN = <em class="replaceable"><code>gettoken_function</code></em> ,
    END = <em class="replaceable"><code>end_function</code></em> ,
    LEXTYPES = <em class="replaceable"><code>lextypes_function</code></em>
    [, HEADLINE = <em class="replaceable"><code>headline_function</code></em> ]
)

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · wiki-repair-20261023:907cc16648022a387fb6a54854ce3e8b8d1475da87afcc7cd51d54aec27a5f5d

Text language: en · wiki-repair-20261023:907cc16648022a387fb6a54854ce3e8b8d1475da87afcc7cd51d54aec27a5f5d