From: Tom Lane Date: Wed, 14 Nov 2007 23:48:55 +0000 (+0000) Subject: Adjust example to reduce confusion between a tsvector column and X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=d8f469fe2a3b1fe288b36e4348346c8b6483c22f;p=users%2Fbernd%2Fpostgres.git Adjust example to reduce confusion between a tsvector column and an index, per Simon. --- diff --git a/doc/src/sgml/textsearch.sgml b/doc/src/sgml/textsearch.sgml index 6d7d2c9a67..982d62a564 100644 --- a/doc/src/sgml/textsearch.sgml +++ b/doc/src/sgml/textsearch.sgml @@ -538,15 +538,15 @@ CREATE INDEX pgweb_idx ON pgweb USING gin(to_tsvector('english', title || body)) indexed when the other is NULL: -ALTER TABLE pgweb ADD COLUMN textsearch_index tsvector; -UPDATE pgweb SET textsearch_index = +ALTER TABLE pgweb ADD COLUMN textsearchable_index_col tsvector; +UPDATE pgweb SET textsearchable_index_col = to_tsvector('english', coalesce(title,'') || coalesce(body,'')); Then we create a GIN index to speed up the search: -CREATE INDEX textsearch_idx ON pgweb USING gin(textsearch_index); +CREATE INDEX textsearch_idx ON pgweb USING gin(textsearchable_index_col); Now we are ready to perform a fast full text search: @@ -554,7 +554,7 @@ CREATE INDEX textsearch_idx ON pgweb USING gin(textsearch_index); SELECT title FROM pgweb -WHERE to_tsquery('create & table') @@ textsearch_index +WHERE textsearchable_index_col @@ to_tsquery('create & table') ORDER BY last_mod_date DESC LIMIT 10;