Skip to content

Commit 3e3bb36

Browse files
committed
First rough cut at text search documentation: bare bones reference
pages for the new SQL commands. I also committed Bruce's text search introductory chapter, as-is except for fixing some markup errors, so that there would be a place for the reference pages to link to.
1 parent 5c681ab commit 3e3bb36

18 files changed

+5224
-10
lines changed

doc/src/sgml/filelist.sgml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/filelist.sgml,v 1.49 2006/11/17 16:38:44 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/filelist.sgml,v 1.50 2007/08/21 21:08:47 tgl Exp $ -->
22

33
<!entity history SYSTEM "history.sgml">
44
<!entity info SYSTEM "info.sgml">
@@ -17,7 +17,6 @@
1717

1818
<!-- user's guide -->
1919
<!entity array SYSTEM "array.sgml">
20-
<!entity rowtypes SYSTEM "rowtypes.sgml">
2120
<!entity datatype SYSTEM "datatype.sgml">
2221
<!entity ddl SYSTEM "ddl.sgml">
2322
<!entity dml SYSTEM "dml.sgml">
@@ -26,7 +25,9 @@
2625
<!entity mvcc SYSTEM "mvcc.sgml">
2726
<!entity perform SYSTEM "perform.sgml">
2827
<!entity queries SYSTEM "queries.sgml">
28+
<!entity rowtypes SYSTEM "rowtypes.sgml">
2929
<!entity syntax SYSTEM "syntax.sgml">
30+
<!entity textsearch SYSTEM "textsearch.sgml">
3031
<!entity typeconv SYSTEM "typeconv.sgml">
3132

3233
<!-- administrator's guide -->

doc/src/sgml/postgres.sgml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/postgres.sgml,v 1.81 2007/01/31 20:56:18 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/postgres.sgml,v 1.82 2007/08/21 21:08:47 tgl Exp $ -->
22

33
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.2//EN" [
44

@@ -101,6 +101,7 @@
101101
&func;
102102
&typeconv;
103103
&indices;
104+
&textsearch;
104105
&mvcc;
105106
&perform;
106107

doc/src/sgml/ref/allfiles.sgml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/allfiles.sgml,v 1.71 2007/07/03 01:30:35 neilc Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/allfiles.sgml,v 1.72 2007/08/21 21:08:47 tgl Exp $
33
PostgreSQL documentation
44
Complete list of usable sgml source files in this directory.
55
-->
@@ -22,6 +22,10 @@ Complete list of usable sgml source files in this directory.
2222
<!entity alterSequence system "alter_sequence.sgml">
2323
<!entity alterTable system "alter_table.sgml">
2424
<!entity alterTableSpace system "alter_tablespace.sgml">
25+
<!entity alterTSConfig system "alter_tsconfig.sgml">
26+
<!entity alterTSDictionary system "alter_tsdictionary.sgml">
27+
<!entity alterTSParser system "alter_tsparser.sgml">
28+
<!entity alterTSTemplate system "alter_tstemplate.sgml">
2529
<!entity alterTrigger system "alter_trigger.sgml">
2630
<!entity alterType system "alter_type.sgml">
2731
<!entity alterUser system "alter_user.sgml">
@@ -56,6 +60,10 @@ Complete list of usable sgml source files in this directory.
5660
<!entity createTableAs system "create_table_as.sgml">
5761
<!entity createTableSpace system "create_tablespace.sgml">
5862
<!entity createTrigger system "create_trigger.sgml">
63+
<!entity createTSConfig system "create_tsconfig.sgml">
64+
<!entity createTSDictionary system "create_tsdictionary.sgml">
65+
<!entity createTSParser system "create_tsparser.sgml">
66+
<!entity createTSTemplate system "create_tstemplate.sgml">
5967
<!entity createType system "create_type.sgml">
6068
<!entity createUser system "create_user.sgml">
6169
<!entity createView system "create_view.sgml">
@@ -83,6 +91,10 @@ Complete list of usable sgml source files in this directory.
8391
<!entity dropTable system "drop_table.sgml">
8492
<!entity dropTableSpace system "drop_tablespace.sgml">
8593
<!entity dropTrigger system "drop_trigger.sgml">
94+
<!entity dropTSConfig system "drop_tsconfig.sgml">
95+
<!entity dropTSDictionary system "drop_tsdictionary.sgml">
96+
<!entity dropTSParser system "drop_tsparser.sgml">
97+
<!entity dropTSTemplate system "drop_tstemplate.sgml">
8698
<!entity dropType system "drop_type.sgml">
8799
<!entity dropUser system "drop_user.sgml">
88100
<!entity dropView system "drop_view.sgml">

doc/src/sgml/ref/alter_tsconfig.sgml

Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
<!--
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_tsconfig.sgml,v 1.1 2007/08/21 21:08:47 tgl Exp $
3+
PostgreSQL documentation
4+
-->
5+
6+
<refentry id="SQL-ALTERTSCONFIG">
7+
<refmeta>
8+
<refentrytitle id="SQL-ALTERTSCONFIG-TITLE">ALTER TEXT SEARCH CONFIGURATION</refentrytitle>
9+
<refmiscinfo>SQL - Language Statements</refmiscinfo>
10+
</refmeta>
11+
12+
<refnamediv>
13+
<refname>ALTER TEXT SEARCH CONFIGURATION</refname>
14+
<refpurpose>change the definition of a text search configuration</refpurpose>
15+
</refnamediv>
16+
17+
<indexterm zone="sql-altertsconfig">
18+
<primary>ALTER TEXT SEARCH CONFIGURATION</primary>
19+
</indexterm>
20+
21+
<refsynopsisdiv>
22+
<synopsis>
23+
ALTER TEXT SEARCH CONFIGURATION <replaceable>name</replaceable> (
24+
PARSER = <replaceable class="parameter">parser_name</replaceable>
25+
)
26+
ALTER TEXT SEARCH CONFIGURATION <replaceable>name</replaceable>
27+
ADD MAPPING FOR <replaceable class="parameter">token_type</replaceable> [, ... ] WITH <replaceable class="parameter">dictionary_name</replaceable> [, ... ]
28+
ALTER TEXT SEARCH CONFIGURATION <replaceable>name</replaceable>
29+
ALTER MAPPING FOR <replaceable class="parameter">token_type</replaceable> [, ... ] WITH <replaceable class="parameter">dictionary_name</replaceable> [, ... ]
30+
ALTER TEXT SEARCH CONFIGURATION <replaceable>name</replaceable>
31+
ALTER MAPPING REPLACE <replaceable class="parameter">old_dictionary</replaceable> WITH <replaceable class="parameter">new_dictionary</replaceable>
32+
ALTER TEXT SEARCH CONFIGURATION <replaceable>name</replaceable>
33+
ALTER MAPPING FOR <replaceable class="parameter">token_type</replaceable> [, ... ] REPLACE <replaceable class="parameter">old_dictionary</replaceable> WITH <replaceable class="parameter">new_dictionary</replaceable>
34+
ALTER TEXT SEARCH CONFIGURATION <replaceable>name</replaceable>
35+
DROP MAPPING [ IF EXISTS ] FOR <replaceable class="parameter">token_type</replaceable> [, ... ]
36+
ALTER TEXT SEARCH CONFIGURATION <replaceable>name</replaceable> RENAME TO <replaceable>newname</replaceable>
37+
ALTER TEXT SEARCH CONFIGURATION <replaceable>name</replaceable> OWNER TO <replaceable>newowner</replaceable>
38+
</synopsis>
39+
</refsynopsisdiv>
40+
41+
<refsect1>
42+
<title>Description</title>
43+
44+
<para>
45+
<command>ALTER TEXT SEARCH CONFIGURATION</command> changes the definition of
46+
a text search configuration. You can change which parser it uses, modify
47+
its mapping from token types to dictionaries,
48+
or change the configuration's name or owner.
49+
</para>
50+
51+
<para>
52+
You must be the owner of the configuration to use
53+
<command>ALTER TEXT SEARCH CONFIGURATION</>.
54+
</para>
55+
</refsect1>
56+
57+
<refsect1>
58+
<title>Parameters</title>
59+
60+
<variablelist>
61+
<varlistentry>
62+
<term><replaceable class="parameter">name</replaceable></term>
63+
<listitem>
64+
<para>
65+
The name (optionally schema-qualified) of an existing text search
66+
configuration.
67+
</para>
68+
</listitem>
69+
</varlistentry>
70+
71+
<varlistentry>
72+
<term><replaceable class="parameter">parser_name</replaceable></term>
73+
<listitem>
74+
<para>
75+
The name of a new text search parser to use for this configuration.
76+
</para>
77+
</listitem>
78+
</varlistentry>
79+
80+
<varlistentry>
81+
<term><replaceable class="parameter">token_type</replaceable></term>
82+
<listitem>
83+
<para>
84+
The name of a token type that is emitted by the configuration's
85+
parser.
86+
</para>
87+
</listitem>
88+
</varlistentry>
89+
90+
<varlistentry>
91+
<term><replaceable class="parameter">dictionary_name</replaceable></term>
92+
<listitem>
93+
<para>
94+
The name of a text search dictionary to be consulted for the
95+
specified token type(s). If multiple dictionaries are listed,
96+
they are consulted in the specified order.
97+
</para>
98+
</listitem>
99+
</varlistentry>
100+
101+
<varlistentry>
102+
<term><replaceable class="parameter">old_dictionary</replaceable></term>
103+
<listitem>
104+
<para>
105+
The name of a text search dictionary to be replaced in the mapping.
106+
</para>
107+
</listitem>
108+
</varlistentry>
109+
110+
<varlistentry>
111+
<term><replaceable class="parameter">old_dictionary</replaceable></term>
112+
<listitem>
113+
<para>
114+
The name of a text search dictionary to be substituted for
115+
<replaceable class="parameter">old_dictionary</replaceable>.
116+
</para>
117+
</listitem>
118+
</varlistentry>
119+
120+
<varlistentry>
121+
<term><replaceable class="parameter">newname</replaceable></term>
122+
<listitem>
123+
<para>
124+
The new name of the text search configuration.
125+
</para>
126+
</listitem>
127+
</varlistentry>
128+
129+
<varlistentry>
130+
<term><replaceable class="parameter">newowner</replaceable></term>
131+
<listitem>
132+
<para>
133+
The new owner of the text search configuration.
134+
</para>
135+
</listitem>
136+
</varlistentry>
137+
</variablelist>
138+
139+
<para>
140+
The <literal>ADD MAPPING FOR</> form installs a list of dictionaries to be
141+
consulted for the specified token type(s); it is an error if there is
142+
already a mapping for any of the token types.
143+
The <literal>ALTER MAPPING FOR</> form does the same, but first removing
144+
any existing mapping for those token types.
145+
The <literal>ALTER MAPPING REPLACE</> forms substitute <replaceable
146+
class="parameter">new_dictionary</replaceable> for <replaceable
147+
class="parameter">old_dictionary</replaceable> anywhere the latter appears.
148+
This is done for only the specified token types when <literal>FOR</>
149+
appears, or for all mappings of the configuration when it doesn't.
150+
The <literal>DROP MAPPING</> form removes all dictionaries for the
151+
specified token type(s), causing tokens of those types to be ignored
152+
by the text search configuration. It is an error if there is no mapping
153+
for the token types, unless <literal>IF EXISTS</> appears.
154+
</para>
155+
156+
</refsect1>
157+
158+
<refsect1>
159+
<title>Notes</title>
160+
161+
<para>
162+
While changing the text search parser used by a configuration is allowed,
163+
this will only work nicely if old and new parsers use the same set of
164+
token types. It is advisable to drop the mappings for any incompatible
165+
token types before changing parsers.
166+
</para>
167+
168+
</refsect1>
169+
170+
<refsect1>
171+
<title>Examples</title>
172+
173+
<para>
174+
The following example replaces the <literal>english</> dictionary
175+
with the <literal>swedish</> dictionary anywhere that <literal>english</>
176+
is used within <literal>my_config</>.
177+
</para>
178+
179+
<programlisting>
180+
ALTER TEXT SEARCH CONFIGURATION my_config
181+
ALTER MAPPING REPLACE english WITH swedish;
182+
</programlisting>
183+
</refsect1>
184+
185+
<refsect1>
186+
<title>Compatibility</title>
187+
188+
<para>
189+
There is no <command>ALTER TEXT SEARCH CONFIGURATION</command> statement in
190+
the SQL standard.
191+
</para>
192+
</refsect1>
193+
194+
<refsect1>
195+
<title>See Also</title>
196+
197+
<simplelist type="inline">
198+
<member><xref linkend="sql-createtsconfig" endterm="sql-createtsconfig-title"></member>
199+
<member><xref linkend="sql-droptsconfig" endterm="sql-droptsconfig-title"></member>
200+
</simplelist>
201+
</refsect1>
202+
</refentry>
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
<!--
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_tsdictionary.sgml,v 1.1 2007/08/21 21:08:47 tgl Exp $
3+
PostgreSQL documentation
4+
-->
5+
6+
<refentry id="SQL-ALTERTSDICTIONARY">
7+
<refmeta>
8+
<refentrytitle id="SQL-ALTERTSDICTIONARY-TITLE">ALTER TEXT SEARCH DICTIONARY</refentrytitle>
9+
<refmiscinfo>SQL - Language Statements</refmiscinfo>
10+
</refmeta>
11+
12+
<refnamediv>
13+
<refname>ALTER TEXT SEARCH DICTIONARY</refname>
14+
<refpurpose>change the definition of a text search dictionary</refpurpose>
15+
</refnamediv>
16+
17+
<indexterm zone="sql-altertsdictionary">
18+
<primary>ALTER TEXT SEARCH DICTIONARY</primary>
19+
</indexterm>
20+
21+
<refsynopsisdiv>
22+
<synopsis>
23+
ALTER TEXT SEARCH DICTIONARY <replaceable>name</replaceable> ( OPTION = <replaceable class="parameter">init_options</replaceable> )
24+
ALTER TEXT SEARCH DICTIONARY <replaceable>name</replaceable> RENAME TO <replaceable>newname</replaceable>
25+
ALTER TEXT SEARCH DICTIONARY <replaceable>name</replaceable> OWNER TO <replaceable>newowner</replaceable>
26+
</synopsis>
27+
</refsynopsisdiv>
28+
29+
<refsect1>
30+
<title>Description</title>
31+
32+
<para>
33+
<command>ALTER TEXT SEARCH DICTIONARY</command> changes the definition of
34+
a text search dictionary. You can change the dictionary's initialization
35+
options, or change the dictionary's name or owner.
36+
</para>
37+
38+
<para>
39+
You must be the owner of the dictionary to use
40+
<command>ALTER TEXT SEARCH DICTIONARY</>.
41+
</para>
42+
</refsect1>
43+
44+
<refsect1>
45+
<title>Parameters</title>
46+
47+
<variablelist>
48+
<varlistentry>
49+
<term><replaceable class="parameter">name</replaceable></term>
50+
<listitem>
51+
<para>
52+
The name (optionally schema-qualified) of an existing text search
53+
dictionary.
54+
</para>
55+
</listitem>
56+
</varlistentry>
57+
58+
<varlistentry>
59+
<term><replaceable class="parameter">init_options</replaceable></term>
60+
<listitem>
61+
<para>
62+
A new list of initialization options, or <literal>NULL</> to
63+
remove all options.
64+
</para>
65+
</listitem>
66+
</varlistentry>
67+
68+
<varlistentry>
69+
<term><replaceable class="parameter">newname</replaceable></term>
70+
<listitem>
71+
<para>
72+
The new name of the text search dictionary.
73+
</para>
74+
</listitem>
75+
</varlistentry>
76+
77+
<varlistentry>
78+
<term><replaceable class="parameter">newowner</replaceable></term>
79+
<listitem>
80+
<para>
81+
The new owner of the text search dictionary.
82+
</para>
83+
</listitem>
84+
</varlistentry>
85+
</variablelist>
86+
</refsect1>
87+
88+
<refsect1>
89+
<title>Examples</title>
90+
91+
<para>
92+
The following example command sets the language and stopword list
93+
for a Snowball-based dictionary.
94+
</para>
95+
96+
<programlisting>
97+
ALTER TEXT SEARCH DICTIONARY my_russian ( option = 'Language=russian, StopWords=my_russian' );
98+
</programlisting>
99+
</refsect1>
100+
101+
<refsect1>
102+
<title>Compatibility</title>
103+
104+
<para>
105+
There is no <command>ALTER TEXT SEARCH DICTIONARY</command> statement in
106+
the SQL standard.
107+
</para>
108+
</refsect1>
109+
110+
<refsect1>
111+
<title>See Also</title>
112+
113+
<simplelist type="inline">
114+
<member><xref linkend="sql-createtsdictionary" endterm="sql-createtsdictionary-title"></member>
115+
<member><xref linkend="sql-droptsdictionary" endterm="sql-droptsdictionary-title"></member>
116+
</simplelist>
117+
</refsect1>
118+
</refentry>

0 commit comments

Comments
 (0)