1<!--
2doc/src/sgml/ref/create_tsparser.sgml
3PostgreSQL documentation
4-->
5
6<refentry id="SQL-CREATETSPARSER">
7 <indexterm zone="sql-createtsparser">
8  <primary>CREATE TEXT SEARCH PARSER</primary>
9 </indexterm>
10
11 <refmeta>
12  <refentrytitle>CREATE TEXT SEARCH PARSER</refentrytitle>
13  <manvolnum>7</manvolnum>
14  <refmiscinfo>SQL - Language Statements</refmiscinfo>
15 </refmeta>
16
17 <refnamediv>
18  <refname>CREATE TEXT SEARCH PARSER</refname>
19  <refpurpose>define a new text search parser</refpurpose>
20 </refnamediv>
21
22 <refsynopsisdiv>
23<synopsis>
24CREATE TEXT SEARCH PARSER <replaceable class="parameter">name</replaceable> (
25    START = <replaceable class="parameter">start_function</replaceable> ,
26    GETTOKEN = <replaceable class="parameter">gettoken_function</replaceable> ,
27    END = <replaceable class="parameter">end_function</replaceable> ,
28    LEXTYPES = <replaceable class="parameter">lextypes_function</replaceable>
29    [, HEADLINE = <replaceable class="parameter">headline_function</replaceable> ]
30)
31</synopsis>
32 </refsynopsisdiv>
33
34 <refsect1>
35  <title>Description</title>
36
37  <para>
38   <command>CREATE TEXT SEARCH PARSER</command> creates a new text search
39   parser.  A text search parser defines a method for splitting a text
40   string into tokens and assigning types (categories) to the tokens.
41   A parser is not particularly useful by itself, but must be bound into a
42   text search configuration along with some text search dictionaries
43   to be used for searching.
44  </para>
45
46  <para>
47   If a schema name is given then the text search parser is created in the
48   specified schema.  Otherwise it is created in the current schema.
49  </para>
50
51  <para>
52   You must be a superuser to use <command>CREATE TEXT SEARCH PARSER</command>.
53   (This restriction is made because an erroneous text search parser
54   definition could confuse or even crash the server.)
55  </para>
56
57  <para>
58   Refer to <xref linkend="textsearch"> for further information.
59  </para>
60 </refsect1>
61
62 <refsect1>
63  <title>Parameters</title>
64
65  <variablelist>
66   <varlistentry>
67    <term><replaceable class="parameter">name</replaceable></term>
68    <listitem>
69     <para>
70      The name of the text search parser to be created.  The name can be
71      schema-qualified.
72     </para>
73    </listitem>
74   </varlistentry>
75
76   <varlistentry>
77    <term><replaceable class="parameter">start_function</replaceable></term>
78    <listitem>
79     <para>
80      The name of the start function for the parser.
81     </para>
82    </listitem>
83   </varlistentry>
84
85   <varlistentry>
86    <term><replaceable class="parameter">gettoken_function</replaceable></term>
87    <listitem>
88     <para>
89      The name of the get-next-token function for the parser.
90     </para>
91    </listitem>
92   </varlistentry>
93
94   <varlistentry>
95    <term><replaceable class="parameter">end_function</replaceable></term>
96    <listitem>
97     <para>
98      The name of the end function for the parser.
99     </para>
100    </listitem>
101   </varlistentry>
102
103   <varlistentry>
104    <term><replaceable class="parameter">lextypes_function</replaceable></term>
105    <listitem>
106     <para>
107      The name of the lextypes function for the parser (a function that
108      returns information about the set of token types it produces).
109     </para>
110    </listitem>
111   </varlistentry>
112
113   <varlistentry>
114    <term><replaceable class="parameter">headline_function</replaceable></term>
115    <listitem>
116     <para>
117      The name of the headline function for the parser (a function that
118      summarizes a set of tokens).
119     </para>
120    </listitem>
121   </varlistentry>
122  </variablelist>
123
124  <para>
125   The function names can be schema-qualified if necessary.  Argument types
126   are not given, since the argument list for each type of function is
127   predetermined.  All except the headline function are required.
128  </para>
129
130  <para>
131   The arguments can appear in any order, not only the one shown above.
132  </para>
133 </refsect1>
134
135 <refsect1>
136  <title>Compatibility</title>
137
138  <para>
139   There is no
140   <command>CREATE TEXT SEARCH PARSER</command> statement in the SQL
141   standard.
142  </para>
143 </refsect1>
144
145 <refsect1>
146  <title>See Also</title>
147
148  <simplelist type="inline">
149   <member><xref linkend="sql-altertsparser"></member>
150   <member><xref linkend="sql-droptsparser"></member>
151  </simplelist>
152 </refsect1>
153</refentry>
154