Skip to content

Commit a1715ac

Browse files
committed
Adjust example to reduce confusion between a tsvector column and
an index, per Simon.
1 parent 866bad9 commit a1715ac

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 COLUMN textsearch_index tsvector;
542-
UPDATE pgweb SET textsearch_index =
541+
ALTER TABLE pgweb ADD COLUMN textsearchable_index_col tsvector;
542+
UPDATE pgweb SET textsearchable_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+
WHERE textsearchable_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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy