Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4c2d0cd

Browse files
committed
Add some quick documentation for tsearch2 compatibility module.
1 parentc027fa5 commit4c2d0cd

File tree

3 files changed

+204
-1
lines changed

3 files changed

+204
-1
lines changed

‎doc/src/sgml/contrib.sgml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
&seg;
5656
&sslinfo;
5757
&tablefunc;
58+
&tsearch2;
5859
&uuid-ossp;
5960
&vacuumlo;
6061
&xml2;

‎doc/src/sgml/filelist.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/filelist.sgml,v 1.52 2007/11/10 23:30:46 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/filelist.sgml,v 1.53 2007/11/14 01:09:50 tgl Exp $ -->
22

33
<!entity history SYSTEM "history.sgml">
44
<!entity info SYSTEM "info.sgml">
@@ -117,6 +117,7 @@
117117
<!entity seg SYSTEM "seg.sgml">
118118
<!entity sslinfo SYSTEM "sslinfo.sgml">
119119
<!entity tablefunc SYSTEM "tablefunc.sgml">
120+
<!entity tsearch2 SYSTEM "tsearch2.sgml">
120121
<!entity uuid-ossp SYSTEM "uuid-ossp.sgml">
121122
<!entity vacuumlo SYSTEM "vacuumlo.sgml">
122123
<!entity xml2 SYSTEM "xml2.sgml">

‎doc/src/sgml/tsearch2.sgml

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
<sect1 id="tsearch2">
2+
<title>tsearch2</title>
3+
4+
<indexterm zone="tsearch2">
5+
<primary>tsearch2</primary>
6+
</indexterm>
7+
8+
<para>
9+
The <literal>tsearch2</literal> module provides backwards-compatible
10+
text search functionality for applications that used
11+
<filename>contrib/tsearch2</> before text searching was integrated
12+
into core <productname>PostgreSQL</productname> in release 8.3.
13+
</para>
14+
15+
<sect2>
16+
<title>Portability Issues</title>
17+
18+
<para>
19+
Although the built-in text search features were based on
20+
<filename>contrib/tsearch2</> and are largely similar to it,
21+
there are numerous small differences that will create portability
22+
issues for existing applications:
23+
</para>
24+
25+
<itemizedlist mark="bullet">
26+
<listitem>
27+
<para>
28+
Some functions' names were changed, for example <function>rank</>
29+
to <function>ts_rank</>.
30+
The replacement <literal>tsearch2</literal> module
31+
provides aliases having the old names.
32+
</para>
33+
</listitem>
34+
35+
<listitem>
36+
<para>
37+
The built-in text search data types and functions all exist within
38+
the system schema <literal>pg_catalog</>. In an installation using
39+
<filename>contrib/tsearch2</>, these objects would usually have been in
40+
the <literal>public</> schema, though some users chose to place them
41+
in a separate schema of their own. Explicitly schema-qualified
42+
references to the objects will therefore fail in either case.
43+
The replacement <literal>tsearch2</literal> module
44+
provides alias objects that are stored in <literal>public</>
45+
(or another schema if necessary) so that such references will still work.
46+
</para>
47+
</listitem>
48+
49+
<listitem>
50+
<para>
51+
There is no concept of a <quote>current parser</> or <quote>current
52+
dictionary</> in the built-in text search features, only of a current
53+
search configuration (set by the <varname>default_text_search_config</>
54+
parameter). While the current parser and current dictionary were used
55+
only by functions intended for debugging, this might still pose
56+
a porting obstacle in some cases.
57+
The replacement <literal>tsearch2</literal> module emulates these
58+
additional state variables and provides backwards-compatible functions
59+
for setting and retrieving them.
60+
</para>
61+
</listitem>
62+
</itemizedlist>
63+
64+
<para>
65+
There are some issues that are not addressed by the replacement
66+
<literal>tsearch2</literal> module, and will therefore require
67+
application code changes in any case:
68+
</para>
69+
70+
<itemizedlist mark="bullet">
71+
<listitem>
72+
<para>
73+
The old <function>tsearch2</> trigger function allowed items in its
74+
argument list to be names of functions to be invoked on the text data
75+
before it was converted to <type>tsvector</> format. This was removed
76+
as being a security hole, since it was not possible to guarantee that
77+
the function invoked was the one intended. The recommended approach
78+
if the data must be massaged before being indexed is to write a custom
79+
trigger that does the work for itself.
80+
</para>
81+
</listitem>
82+
83+
<listitem>
84+
<para>
85+
Text search configuration information has been moved into core
86+
system catalogs that are noticeably different from the tables used
87+
by <filename>contrib/tsearch2</>. Any applications that examined
88+
or modified those tables will need adjustment.
89+
</para>
90+
</listitem>
91+
92+
<listitem>
93+
<para>
94+
If an application used any custom text search configurations,
95+
those will need to be set up in the core
96+
catalogs using the new text search configuration SQL commands.
97+
The replacement <literal>tsearch2</literal> module offers a little
98+
bit of support for this by making it possible to load an old set
99+
of <filename>contrib/tsearch2</> configuration tables into
100+
<productname>PostgreSQL</productname> 8.3. (Without the module,
101+
it is not possible to load the configuration data because values in the
102+
<type>regprocedure</> columns cannot be resolved to functions.)
103+
While those configuration tables won't actually <emphasis>do</>
104+
anything, at least their contents will be available to be consulted
105+
while setting up an equivalent custom configuration in 8.3.
106+
</para>
107+
</listitem>
108+
109+
<listitem>
110+
<para>
111+
The old <function>reset_tsearch()</> and <function>get_covers()</>
112+
functions are not supported.
113+
</para>
114+
</listitem>
115+
116+
<listitem>
117+
<para>
118+
The replacement <literal>tsearch2</literal> module does not define
119+
any alias operators, relying entirely on the built-in ones.
120+
This would only pose an issue if an application used explicitly
121+
schema-qualified operator names, which is very uncommon.
122+
</para>
123+
</listitem>
124+
</itemizedlist>
125+
126+
</sect2>
127+
128+
<sect2>
129+
<title>Converting a pre-8.3 Installation</title>
130+
131+
<para>
132+
The recommended way to update a pre-8.3 installation that uses
133+
<filename>contrib/tsearch2</> is:
134+
</para>
135+
136+
<procedure>
137+
<step>
138+
<para>
139+
Make a dump from the old installation in the usual way,
140+
but be sure not to use <literal>-c</> (<literal>--clean</>)
141+
option of <application>pg_dump</> or <application>pg_dumpall</>.
142+
</para>
143+
</step>
144+
145+
<step>
146+
<para>
147+
In the new installation, create empty database(s) and install
148+
the replacement <literal>tsearch2</literal> module into each
149+
database that will use text search. This must be done
150+
<emphasis>before</> loading the dump data! If your old installation
151+
had the <filename>contrib/tsearch2</> objects in a schema other
152+
than <literal>public</>, be sure to adjust the
153+
<literal>tsearch2</literal> installation script so that the replacement
154+
objects are created in that same schema.
155+
</para>
156+
</step>
157+
158+
<step>
159+
<para>
160+
Load the dump data. There will be quite a few errors reported
161+
due to failure to recreate the original <filename>contrib/tsearch2</>
162+
objects. These errors can be ignored, but this means you cannot
163+
restore the dump in a single transaction (eg, you cannot use
164+
<application>pg_restore</>'s <literal>-1</> switch).
165+
</para>
166+
</step>
167+
168+
<step>
169+
<para>
170+
Examine the contents of the restored <filename>contrib/tsearch2</>
171+
configuration tables (<structname>pg_ts_cfg</> and so on), and
172+
create equivalent built-in text search configurations as needed.
173+
You may drop the old configuration tables once you've extracted
174+
all the useful information from them.
175+
</para>
176+
</step>
177+
178+
<step>
179+
<para>
180+
Test your application.
181+
</para>
182+
</step>
183+
</procedure>
184+
185+
<para>
186+
At a later time you may wish to rename application references
187+
to the alias text search objects, so that you can eventually
188+
uninstall the replacement <literal>tsearch2</literal> module.
189+
</para>
190+
191+
</sect2>
192+
193+
<sect2>
194+
<title>References</title>
195+
<para>
196+
Tsearch2 Development Site
197+
<ulink url="http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/"></ulink>
198+
</para>
199+
</sect2>
200+
201+
</sect1>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp