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

Commita1715ac

Browse files
committed
Adjust example to reduce confusion between a tsvector column and
an index, per Simon.
1 parent866bad9 commita1715ac

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

‎doc/src/sgml/textsearch.sgml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/textsearch.sgml,v 1.34 2007/11/14 23:43:27 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/textsearch.sgml,v 1.35 2007/11/14 23:48:55 tgl Exp $ -->
22

33
<chapter id="textsearch">
44
<title id="textsearch-title">Full Text Search</title>
@@ -538,23 +538,23 @@ CREATE INDEX pgweb_idx ON pgweb USING gin(to_tsvector('english', title || body))
538538
indexed when the other is <literal>NULL</>:
539539

540540
<programlisting>
541-
ALTER TABLE pgweb ADD COLUMNtextsearch_index tsvector;
542-
UPDATE pgweb SETtextsearch_index =
541+
ALTER TABLE pgweb ADD COLUMNtextsearchable_index_col tsvector;
542+
UPDATE pgweb SETtextsearchable_index_col =
543543
to_tsvector('english', coalesce(title,'') || coalesce(body,''));
544544
</programlisting>
545545

546546
Then we create a <acronym>GIN</acronym> index to speed up the search:
547547

548548
<programlisting>
549-
CREATE INDEX textsearch_idx ON pgweb USING gin(textsearch_index);
549+
CREATE INDEX textsearch_idx ON pgweb USING gin(textsearchable_index_col);
550550
</programlisting>
551551

552552
Now we are ready to perform a fast full text search:
553553

554554
<programlisting>
555555
SELECT title
556556
FROM pgweb
557-
WHERE to_tsquery('create &amp; table') @@ textsearch_index
557+
WHEREtextsearchable_index_col @@to_tsquery('create &amp; table')
558558
ORDER BY last_mod_date DESC LIMIT 10;
559559
</programlisting>
560560
</para>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp