Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d321421

Browse files
committed
Simplify the syntax of CREATE/ALTER TEXT SEARCH DICTIONARY by treating the
init options of the template as top-level options in the syntax. This also makes ALTER a bit easier to use, since options can be replaced individually. I also made these statements verify that the tmplinit method will accept the new settings before they get stored; in the original coding you didn't find out about mistakes until the dictionary got invoked. Under the hood, init methods now get options as a List of DefElem instead of a raw text string --- that lets tsearch use existing options-pushing code instead of duplicating functionality.
1 parent fd33d90 commit d321421

File tree

17 files changed

+618
-417
lines changed

17 files changed

+618
-417
lines changed

doc/src/sgml/ref/alter_tsdictionary.sgml

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_tsdictionary.sgml,v 1.1 2007/08/21 21:08:47 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_tsdictionary.sgml,v 1.2 2007/08/22 01:39:44 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -20,7 +20,9 @@ PostgreSQL documentation
2020

2121
<refsynopsisdiv>
2222
<synopsis>
23-
ALTER TEXT SEARCH DICTIONARY <replaceable>name</replaceable> ( OPTION = <replaceable class="parameter">init_options</replaceable> )
23+
ALTER TEXT SEARCH DICTIONARY <replaceable>name</replaceable> (
24+
<replaceable class="parameter">option</replaceable> [ = <replaceable class="parameter">value</replaceable> ] [, ... ]
25+
)
2426
ALTER TEXT SEARCH DICTIONARY <replaceable>name</replaceable> RENAME TO <replaceable>newname</replaceable>
2527
ALTER TEXT SEARCH DICTIONARY <replaceable>name</replaceable> OWNER TO <replaceable>newowner</replaceable>
2628
</synopsis>
@@ -31,8 +33,8 @@ ALTER TEXT SEARCH DICTIONARY <replaceable>name</replaceable> OWNER TO <replaceab
3133

3234
<para>
3335
<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+
a text search dictionary. You can change the dictionary's
37+
template-specific options, or change the dictionary's name or owner.
3638
</para>
3739

3840
<para>
@@ -56,11 +58,22 @@ ALTER TEXT SEARCH DICTIONARY <replaceable>name</replaceable> OWNER TO <replaceab
5658
</varlistentry>
5759

5860
<varlistentry>
59-
<term><replaceable class="parameter">init_options</replaceable></term>
61+
<term><replaceable class="parameter">option</replaceable></term>
6062
<listitem>
6163
<para>
62-
A new list of initialization options, or <literal>NULL</> to
63-
remove all options.
64+
The name of a template-specific option to be set for this dictionary.
65+
</para>
66+
</listitem>
67+
</varlistentry>
68+
69+
<varlistentry>
70+
<term><replaceable class="parameter">value</replaceable></term>
71+
<listitem>
72+
<para>
73+
The new value to use for a template-specific option.
74+
If the equal sign and value are omitted, then any previous
75+
setting for the option is removed from the dictionary,
76+
allowing the default to be used.
6477
</para>
6578
</listitem>
6679
</varlistentry>
@@ -83,18 +96,31 @@ ALTER TEXT SEARCH DICTIONARY <replaceable>name</replaceable> OWNER TO <replaceab
8396
</listitem>
8497
</varlistentry>
8598
</variablelist>
99+
100+
<para>
101+
Template-specific options can appear in any order.
102+
</para>
86103
</refsect1>
87104

88105
<refsect1>
89106
<title>Examples</title>
90107

91108
<para>
92-
The following example command sets the language and stopword list
93-
for a Snowball-based dictionary.
109+
The following example command changes the stopword list
110+
for a Snowball-based dictionary. Other parameters remain unchanged.
111+
</para>
112+
113+
<programlisting>
114+
ALTER TEXT SEARCH DICTIONARY my_dict ( StopWords = newrussian );
115+
</programlisting>
116+
117+
<para>
118+
The following example command changes the language option to dutch,
119+
and removes the stopword option entirely.
94120
</para>
95121

96122
<programlisting>
97-
ALTER TEXT SEARCH DICTIONARY my_russian ( option = 'Language=russian, StopWords=my_russian' );
123+
ALTER TEXT SEARCH DICTIONARY my_dict ( language = dutch, StopWords );
98124
</programlisting>
99125
</refsect1>
100126

doc/src/sgml/ref/create_tsdictionary.sgml

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/create_tsdictionary.sgml,v 1.1 2007/08/21 21:08:47 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/create_tsdictionary.sgml,v 1.2 2007/08/22 01:39:44 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -22,7 +22,7 @@ PostgreSQL documentation
2222
<synopsis>
2323
CREATE TEXT SEARCH DICTIONARY <replaceable class="parameter">name</replaceable> (
2424
TEMPLATE = <replaceable class="parameter">template</replaceable>
25-
[, OPTION = <replaceable class="parameter">init_options</replaceable> ]
25+
[, <replaceable class="parameter">option</replaceable> = <replaceable class="parameter">value</replaceable> [, ... ]]
2626
)
2727
</synopsis>
2828
</refsynopsisdiv>
@@ -78,17 +78,46 @@ CREATE TEXT SEARCH DICTIONARY <replaceable class="parameter">name</replaceable>
7878
</varlistentry>
7979

8080
<varlistentry>
81-
<term><replaceable class="parameter">init_options</replaceable></term>
81+
<term><replaceable class="parameter">option</replaceable></term>
8282
<listitem>
8383
<para>
84-
A list of initialization options for the template functions.
85-
This is a string containing <replaceable>keyword</> <literal>=</>
86-
<replaceable>value</> pairs. The specific keywords allowed
87-
vary depending on the text search template.
84+
The name of a template-specific option to be set for this dictionary.
85+
</para>
86+
</listitem>
87+
</varlistentry>
88+
89+
<varlistentry>
90+
<term><replaceable class="parameter">value</replaceable></term>
91+
<listitem>
92+
<para>
93+
The value to use for a template-specific option. If the value
94+
is not a simple identifier or number, it must be quoted (but you can
95+
always quote it, if you wish).
8896
</para>
8997
</listitem>
9098
</varlistentry>
9199
</variablelist>
100+
101+
<para>
102+
The options can appear in any order.
103+
</para>
104+
</refsect1>
105+
106+
<refsect1>
107+
<title>Examples</title>
108+
109+
<para>
110+
The following example command creates a Snowball-based dictionary
111+
with a nonstandard list of stop words.
112+
</para>
113+
114+
<programlisting>
115+
CREATE TEXT SEARCH DICTIONARY my_russian (
116+
template = snowball,
117+
language = russian,
118+
stopwords = myrussian
119+
);
120+
</programlisting>
92121
</refsect1>
93122

94123
<refsect1>

0 commit comments

Comments
 (0)