1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>CREATE TEXT SEARCH TEMPLATE</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="sql-createtsparser.html" title="CREATE TEXT SEARCH PARSER" /><link rel="next" href="sql-createtransform.html" title="CREATE TRANSFORM" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">CREATE TEXT SEARCH TEMPLATE</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="sql-createtsparser.html" title="CREATE TEXT SEARCH PARSER">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="sql-commands.html" title="SQL Commands">Up</a></td><th width="60%" align="center">SQL Commands</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="sql-createtransform.html" title="CREATE TRANSFORM">Next</a></td></tr></table><hr /></div><div class="refentry" id="SQL-CREATETSTEMPLATE"><div class="titlepage"></div><a id="id-1.9.3.91.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle">CREATE TEXT SEARCH TEMPLATE</span></h2><p>CREATE TEXT SEARCH TEMPLATE — define a new text search template</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
3 CREATE TEXT SEARCH TEMPLATE <em class="replaceable"><code>name</code></em> (
4 [ INIT = <em class="replaceable"><code>init_function</code></em> , ]
5 LEXIZE = <em class="replaceable"><code>lexize_function</code></em>
7 </pre></div><div class="refsect1" id="id-1.9.3.91.5"><h2>Description</h2><p>
8 <code class="command">CREATE TEXT SEARCH TEMPLATE</code> creates a new text search
9 template. Text search templates define the functions that implement
10 text search dictionaries. A template is not useful by itself, but must
11 be instantiated as a dictionary to be used. The dictionary typically
12 specifies parameters to be given to the template functions.
14 If a schema name is given then the text search template is created in the
15 specified schema. Otherwise it is created in the current schema.
17 You must be a superuser to use <code class="command">CREATE TEXT SEARCH
18 TEMPLATE</code>. This restriction is made because an erroneous text
19 search template definition could confuse or even crash the server.
20 The reason for separating templates from dictionaries is that a template
21 encapsulates the <span class="quote">“<span class="quote">unsafe</span>”</span> aspects of defining a dictionary.
22 The parameters that can be set when defining a dictionary are safe for
23 unprivileged users to set, and so creating a dictionary need not be a
26 Refer to <a class="xref" href="textsearch.html" title="Chapter 12. Full Text Search">Chapter 12</a> for further information.
27 </p></div><div class="refsect1" id="id-1.9.3.91.6"><h2>Parameters</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>name</code></em></span></dt><dd><p>
28 The name of the text search template to be created. The name can be
30 </p></dd><dt><span class="term"><em class="replaceable"><code>init_function</code></em></span></dt><dd><p>
31 The name of the init function for the template.
32 </p></dd><dt><span class="term"><em class="replaceable"><code>lexize_function</code></em></span></dt><dd><p>
33 The name of the lexize function for the template.
34 </p></dd></dl></div><p>
35 The function names can be schema-qualified if necessary. Argument types
36 are not given, since the argument list for each type of function is
37 predetermined. The lexize function is required, but the init function
40 The arguments can appear in any order, not only the one shown above.
41 </p></div><div class="refsect1" id="id-1.9.3.91.7"><h2>Compatibility</h2><p>
43 <code class="command">CREATE TEXT SEARCH TEMPLATE</code> statement in the SQL
45 </p></div><div class="refsect1" id="id-1.9.3.91.8"><h2>See Also</h2><span class="simplelist"><a class="xref" href="sql-altertstemplate.html" title="ALTER TEXT SEARCH TEMPLATE"><span class="refentrytitle">ALTER TEXT SEARCH TEMPLATE</span></a>, <a class="xref" href="sql-droptstemplate.html" title="DROP TEXT SEARCH TEMPLATE"><span class="refentrytitle">DROP TEXT SEARCH TEMPLATE</span></a></span></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sql-createtsparser.html" title="CREATE TEXT SEARCH PARSER">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="sql-commands.html" title="SQL Commands">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sql-createtransform.html" title="CREATE TRANSFORM">Next</a></td></tr><tr><td width="40%" align="left" valign="top">CREATE TEXT SEARCH PARSER </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> CREATE TRANSFORM</td></tr></table></div></body></html>