~ubuntu-branches/debian/sid/postgresql-9.3/sid

« back to all changes in this revision

Viewing changes to doc/src/sgml/html/tsearch2.html

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2013-05-08 05:39:52 UTC
  • Revision ID: package-import@ubuntu.com-20130508053952-1j7uilp7mjtrvq8q
Tags: upstream-9.3~beta1
ImportĀ upstreamĀ versionĀ 9.3~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 
2
<HTML
 
3
><HEAD
 
4
><TITLE
 
5
>tsearch2</TITLE
 
6
><META
 
7
NAME="GENERATOR"
 
8
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
 
9
REV="MADE"
 
10
HREF="mailto:pgsql-docs@postgresql.org"><LINK
 
11
REL="HOME"
 
12
TITLE="PostgreSQL 9.3beta1 Documentation"
 
13
HREF="index.html"><LINK
 
14
REL="UP"
 
15
TITLE="Additional Supplied Modules"
 
16
HREF="contrib.html"><LINK
 
17
REL="PREVIOUS"
 
18
TITLE="test_parser"
 
19
HREF="test-parser.html"><LINK
 
20
REL="NEXT"
 
21
TITLE="unaccent"
 
22
HREF="unaccent.html"><LINK
 
23
REL="STYLESHEET"
 
24
TYPE="text/css"
 
25
HREF="stylesheet.css"><META
 
26
HTTP-EQUIV="Content-Type"
 
27
CONTENT="text/html; charset=ISO-8859-1"><META
 
28
NAME="creation"
 
29
CONTENT="2013-05-06T21:00:50"></HEAD
 
30
><BODY
 
31
CLASS="SECT1"
 
32
><DIV
 
33
CLASS="NAVHEADER"
 
34
><TABLE
 
35
SUMMARY="Header navigation table"
 
36
WIDTH="100%"
 
37
BORDER="0"
 
38
CELLPADDING="0"
 
39
CELLSPACING="0"
 
40
><TR
 
41
><TH
 
42
COLSPAN="5"
 
43
ALIGN="center"
 
44
VALIGN="bottom"
 
45
><A
 
46
HREF="index.html"
 
47
>PostgreSQL 9.3beta1 Documentation</A
 
48
></TH
 
49
></TR
 
50
><TR
 
51
><TD
 
52
WIDTH="10%"
 
53
ALIGN="left"
 
54
VALIGN="top"
 
55
><A
 
56
TITLE="test_parser"
 
57
HREF="test-parser.html"
 
58
ACCESSKEY="P"
 
59
>Prev</A
 
60
></TD
 
61
><TD
 
62
WIDTH="10%"
 
63
ALIGN="left"
 
64
VALIGN="top"
 
65
><A
 
66
HREF="contrib.html"
 
67
ACCESSKEY="U"
 
68
>Up</A
 
69
></TD
 
70
><TD
 
71
WIDTH="60%"
 
72
ALIGN="center"
 
73
VALIGN="bottom"
 
74
>Appendix F. Additional Supplied Modules</TD
 
75
><TD
 
76
WIDTH="20%"
 
77
ALIGN="right"
 
78
VALIGN="top"
 
79
><A
 
80
TITLE="unaccent"
 
81
HREF="unaccent.html"
 
82
ACCESSKEY="N"
 
83
>Next</A
 
84
></TD
 
85
></TR
 
86
></TABLE
 
87
><HR
 
88
ALIGN="LEFT"
 
89
WIDTH="100%"></DIV
 
90
><DIV
 
91
CLASS="SECT1"
 
92
><H1
 
93
CLASS="SECT1"
 
94
><A
 
95
NAME="TSEARCH2"
 
96
>F.39. tsearch2</A
 
97
></H1
 
98
><P
 
99
>  The <SPAN
 
100
CLASS="APPLICATION"
 
101
>tsearch2</SPAN
 
102
> module provides backwards-compatible
 
103
  text search functionality for applications that used
 
104
  <SPAN
 
105
CLASS="APPLICATION"
 
106
>tsearch2</SPAN
 
107
> before text searching was integrated
 
108
  into core <SPAN
 
109
CLASS="PRODUCTNAME"
 
110
>PostgreSQL</SPAN
 
111
> in release 8.3.
 
112
 </P
 
113
><DIV
 
114
CLASS="SECT2"
 
115
><H2
 
116
CLASS="SECT2"
 
117
><A
 
118
NAME="AEN149963"
 
119
>F.39.1. Portability Issues</A
 
120
></H2
 
121
><P
 
122
>   Although the built-in text search features were based on
 
123
   <SPAN
 
124
CLASS="APPLICATION"
 
125
>tsearch2</SPAN
 
126
> and are largely similar to it,
 
127
   there are numerous small differences that will create portability
 
128
   issues for existing applications:
 
129
  </P
 
130
><P
 
131
></P
 
132
><UL
 
133
><LI
 
134
STYLE="list-style-type: disc"
 
135
><P
 
136
>     Some functions' names were changed, for example <CODE
 
137
CLASS="FUNCTION"
 
138
>rank</CODE
 
139
>
 
140
     to <CODE
 
141
CLASS="FUNCTION"
 
142
>ts_rank</CODE
 
143
>.
 
144
     The replacement <TT
 
145
CLASS="LITERAL"
 
146
>tsearch2</TT
 
147
> module
 
148
     provides aliases having the old names.
 
149
    </P
 
150
></LI
 
151
><LI
 
152
STYLE="list-style-type: disc"
 
153
><P
 
154
>     The built-in text search data types and functions all exist within
 
155
     the system schema <TT
 
156
CLASS="LITERAL"
 
157
>pg_catalog</TT
 
158
>.  In an installation using
 
159
     <SPAN
 
160
CLASS="APPLICATION"
 
161
>tsearch2</SPAN
 
162
>, these objects would usually have been in
 
163
     the <TT
 
164
CLASS="LITERAL"
 
165
>public</TT
 
166
> schema, though some users chose to place them
 
167
     in a separate schema of their own.  Explicitly schema-qualified
 
168
     references to the objects will therefore fail in either case.
 
169
     The replacement <TT
 
170
CLASS="LITERAL"
 
171
>tsearch2</TT
 
172
> module
 
173
     provides alias objects that are stored in <TT
 
174
CLASS="LITERAL"
 
175
>public</TT
 
176
>
 
177
     (or another schema if necessary) so that such references will still work.
 
178
    </P
 
179
></LI
 
180
><LI
 
181
STYLE="list-style-type: disc"
 
182
><P
 
183
>     There is no concept of a <SPAN
 
184
CLASS="QUOTE"
 
185
>"current parser"</SPAN
 
186
> or <SPAN
 
187
CLASS="QUOTE"
 
188
>"current
 
189
     dictionary"</SPAN
 
190
> in the built-in text search features, only of a current
 
191
     search configuration (set by the <TT
 
192
CLASS="VARNAME"
 
193
>default_text_search_config</TT
 
194
>
 
195
     parameter).  While the current parser and current dictionary were used
 
196
     only by functions intended for debugging, this might still pose
 
197
     a porting obstacle in some cases.
 
198
     The replacement <TT
 
199
CLASS="LITERAL"
 
200
>tsearch2</TT
 
201
> module emulates these
 
202
     additional state variables and provides backwards-compatible functions
 
203
     for setting and retrieving them.
 
204
    </P
 
205
></LI
 
206
></UL
 
207
><P
 
208
>   There are some issues that are not addressed by the replacement
 
209
   <TT
 
210
CLASS="LITERAL"
 
211
>tsearch2</TT
 
212
> module, and will therefore require
 
213
   application code changes in any case:
 
214
  </P
 
215
><P
 
216
></P
 
217
><UL
 
218
><LI
 
219
STYLE="list-style-type: disc"
 
220
><P
 
221
>     The old <CODE
 
222
CLASS="FUNCTION"
 
223
>tsearch2</CODE
 
224
> trigger function allowed items in its
 
225
     argument list to be names of functions to be invoked on the text data
 
226
     before it was converted to <TT
 
227
CLASS="TYPE"
 
228
>tsvector</TT
 
229
> format.  This was removed
 
230
     as being a security hole, since it was not possible to guarantee that
 
231
     the function invoked was the one intended.  The recommended approach
 
232
     if the data must be massaged before being indexed is to write a custom
 
233
     trigger that does the work for itself.
 
234
    </P
 
235
></LI
 
236
><LI
 
237
STYLE="list-style-type: disc"
 
238
><P
 
239
>     Text search configuration information has been moved into core
 
240
     system catalogs that are noticeably different from the tables used
 
241
     by <SPAN
 
242
CLASS="APPLICATION"
 
243
>tsearch2</SPAN
 
244
>.  Any applications that examined
 
245
     or modified those tables will need adjustment.
 
246
    </P
 
247
></LI
 
248
><LI
 
249
STYLE="list-style-type: disc"
 
250
><P
 
251
>     If an application used any custom text search configurations,
 
252
     those will need to be set up in the core
 
253
     catalogs using the new text search configuration SQL commands.
 
254
     The replacement <TT
 
255
CLASS="LITERAL"
 
256
>tsearch2</TT
 
257
> module offers a little
 
258
     bit of support for this by making it possible to load an old set
 
259
     of <SPAN
 
260
CLASS="APPLICATION"
 
261
>tsearch2</SPAN
 
262
> configuration tables into
 
263
     <SPAN
 
264
CLASS="PRODUCTNAME"
 
265
>PostgreSQL</SPAN
 
266
> 8.3.  (Without the module,
 
267
     it is not possible to load the configuration data because values in the
 
268
     <TT
 
269
CLASS="TYPE"
 
270
>regprocedure</TT
 
271
> columns cannot be resolved to functions.)
 
272
     While those configuration tables won't actually <SPAN
 
273
CLASS="emphasis"
 
274
><I
 
275
CLASS="EMPHASIS"
 
276
>do</I
 
277
></SPAN
 
278
>
 
279
     anything, at least their contents will be available to be consulted
 
280
     while setting up an equivalent custom configuration in 8.3.
 
281
    </P
 
282
></LI
 
283
><LI
 
284
STYLE="list-style-type: disc"
 
285
><P
 
286
>     The old <CODE
 
287
CLASS="FUNCTION"
 
288
>reset_tsearch()</CODE
 
289
> and <CODE
 
290
CLASS="FUNCTION"
 
291
>get_covers()</CODE
 
292
>
 
293
     functions are not supported.
 
294
    </P
 
295
></LI
 
296
><LI
 
297
STYLE="list-style-type: disc"
 
298
><P
 
299
>     The replacement <TT
 
300
CLASS="LITERAL"
 
301
>tsearch2</TT
 
302
> module does not define
 
303
     any alias operators, relying entirely on the built-in ones.
 
304
     This would only pose an issue if an application used explicitly
 
305
     schema-qualified operator names, which is very uncommon.
 
306
    </P
 
307
></LI
 
308
></UL
 
309
></DIV
 
310
><DIV
 
311
CLASS="SECT2"
 
312
><H2
 
313
CLASS="SECT2"
 
314
><A
 
315
NAME="AEN150010"
 
316
>F.39.2. Converting a pre-8.3 Installation</A
 
317
></H2
 
318
><P
 
319
>   The recommended way to update a pre-8.3 installation that uses
 
320
   <SPAN
 
321
CLASS="APPLICATION"
 
322
>tsearch2</SPAN
 
323
> is:
 
324
  </P
 
325
><DIV
 
326
CLASS="PROCEDURE"
 
327
><OL
 
328
TYPE="1"
 
329
><LI
 
330
CLASS="STEP"
 
331
><P
 
332
>     Make a dump from the old installation in the usual way,
 
333
     but be sure not to use <TT
 
334
CLASS="LITERAL"
 
335
>-c</TT
 
336
> (<TT
 
337
CLASS="LITERAL"
 
338
>--clean</TT
 
339
>)
 
340
     option of <SPAN
 
341
CLASS="APPLICATION"
 
342
>pg_dump</SPAN
 
343
> or <SPAN
 
344
CLASS="APPLICATION"
 
345
>pg_dumpall</SPAN
 
346
>.
 
347
    </P
 
348
></LI
 
349
><LI
 
350
CLASS="STEP"
 
351
><P
 
352
>     In the new installation, create empty database(s) and install
 
353
     the replacement <TT
 
354
CLASS="LITERAL"
 
355
>tsearch2</TT
 
356
> module into each
 
357
     database that will use text search.  This must be done
 
358
     <SPAN
 
359
CLASS="emphasis"
 
360
><I
 
361
CLASS="EMPHASIS"
 
362
>before</I
 
363
></SPAN
 
364
> loading the dump data!  If your old installation
 
365
     had the <SPAN
 
366
CLASS="APPLICATION"
 
367
>tsearch2</SPAN
 
368
> objects in a schema other
 
369
     than <TT
 
370
CLASS="LITERAL"
 
371
>public</TT
 
372
>, be sure to adjust the
 
373
     <TT
 
374
CLASS="COMMAND"
 
375
>CREATE EXTENSION</TT
 
376
> command so that the replacement
 
377
     objects are created in that same schema.
 
378
    </P
 
379
></LI
 
380
><LI
 
381
CLASS="STEP"
 
382
><P
 
383
>     Load the dump data.  There will be quite a few errors reported
 
384
     due to failure to recreate the original <SPAN
 
385
CLASS="APPLICATION"
 
386
>tsearch2</SPAN
 
387
>
 
388
     objects.  These errors can be ignored, but this means you cannot
 
389
     restore the dump in a single transaction (eg, you cannot use
 
390
     <SPAN
 
391
CLASS="APPLICATION"
 
392
>pg_restore</SPAN
 
393
>'s <TT
 
394
CLASS="OPTION"
 
395
>-1</TT
 
396
> switch).
 
397
    </P
 
398
></LI
 
399
><LI
 
400
CLASS="STEP"
 
401
><P
 
402
>     Examine the contents of the restored <SPAN
 
403
CLASS="APPLICATION"
 
404
>tsearch2</SPAN
 
405
>
 
406
     configuration tables (<TT
 
407
CLASS="STRUCTNAME"
 
408
>pg_ts_cfg</TT
 
409
> and so on), and
 
410
     create equivalent built-in text search configurations as needed.
 
411
     You may drop the old configuration tables once you've extracted
 
412
     all the useful information from them.
 
413
    </P
 
414
></LI
 
415
><LI
 
416
CLASS="STEP"
 
417
><P
 
418
>     Test your application.
 
419
    </P
 
420
></LI
 
421
></OL
 
422
></DIV
 
423
><P
 
424
>   At a later time you may wish to rename application references
 
425
   to the alias text search objects, so that you can eventually
 
426
   uninstall the replacement <TT
 
427
CLASS="LITERAL"
 
428
>tsearch2</TT
 
429
> module.
 
430
  </P
 
431
></DIV
 
432
><DIV
 
433
CLASS="SECT2"
 
434
><H2
 
435
CLASS="SECT2"
 
436
><A
 
437
NAME="AEN150041"
 
438
>F.39.3. References</A
 
439
></H2
 
440
><P
 
441
>   Tsearch2 Development Site
 
442
   <A
 
443
HREF="http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/"
 
444
TARGET="_top"
 
445
>http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/</A
 
446
>
 
447
  </P
 
448
></DIV
 
449
></DIV
 
450
><DIV
 
451
CLASS="NAVFOOTER"
 
452
><HR
 
453
ALIGN="LEFT"
 
454
WIDTH="100%"><TABLE
 
455
SUMMARY="Footer navigation table"
 
456
WIDTH="100%"
 
457
BORDER="0"
 
458
CELLPADDING="0"
 
459
CELLSPACING="0"
 
460
><TR
 
461
><TD
 
462
WIDTH="33%"
 
463
ALIGN="left"
 
464
VALIGN="top"
 
465
><A
 
466
HREF="test-parser.html"
 
467
ACCESSKEY="P"
 
468
>Prev</A
 
469
></TD
 
470
><TD
 
471
WIDTH="34%"
 
472
ALIGN="center"
 
473
VALIGN="top"
 
474
><A
 
475
HREF="index.html"
 
476
ACCESSKEY="H"
 
477
>Home</A
 
478
></TD
 
479
><TD
 
480
WIDTH="33%"
 
481
ALIGN="right"
 
482
VALIGN="top"
 
483
><A
 
484
HREF="unaccent.html"
 
485
ACCESSKEY="N"
 
486
>Next</A
 
487
></TD
 
488
></TR
 
489
><TR
 
490
><TD
 
491
WIDTH="33%"
 
492
ALIGN="left"
 
493
VALIGN="top"
 
494
>test_parser</TD
 
495
><TD
 
496
WIDTH="34%"
 
497
ALIGN="center"
 
498
VALIGN="top"
 
499
><A
 
500
HREF="contrib.html"
 
501
ACCESSKEY="U"
 
502
>Up</A
 
503
></TD
 
504
><TD
 
505
WIDTH="33%"
 
506
ALIGN="right"
 
507
VALIGN="top"
 
508
>unaccent</TD
 
509
></TR
 
510
></TABLE
 
511
></DIV
 
512
></BODY
 
513
></HTML
 
514
>
 
 
b'\\ No newline at end of file'