aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2009-04-19 20:36:13 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2009-04-19 20:36:13 +0000
commitf3676bcee5bb6e03acf5d0d2b1cb0f065e3bad0d (patch)
treeaf9641d895ea1cf18e5efdb1d64a9cd779c7a608
parent57af05af0ecd8022c614d271aae4ddea9ba7927e (diff)
downloadpostgresql-f3676bcee5bb6e03acf5d0d2b1cb0f065e3bad0d.tar.gz
postgresql-f3676bcee5bb6e03acf5d0d2b1cb0f065e3bad0d.zip
Fix textsearch documentation examples to not recommend concatenating separate
fields without putting a space between. Per gripe from Rick Schumeyer.
-rw-r--r--doc/src/sgml/textsearch.sgml12
1 files changed, 6 insertions, 6 deletions
diff --git a/doc/src/sgml/textsearch.sgml b/doc/src/sgml/textsearch.sgml
index 1b0fc7018e6..f4a3ec5dd7c 100644
--- a/doc/src/sgml/textsearch.sgml
+++ b/doc/src/sgml/textsearch.sgml
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/textsearch.sgml,v 1.40.2.1 2008/03/04 03:17:26 momjian Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/textsearch.sgml,v 1.40.2.2 2009/04/19 20:36:13 tgl Exp $ -->
<chapter id="textsearch">
<title id="textsearch-title">Full Text Search</title>
@@ -454,12 +454,12 @@ WHERE to_tsvector(body) @@ to_tsquery('friend');
<programlisting>
SELECT title
FROM pgweb
-WHERE to_tsvector(title || body) @@ to_tsquery('create &amp; table')
+WHERE to_tsvector(title || ' ' || body) @@ to_tsquery('create &amp; table')
ORDER BY last_mod_date DESC LIMIT 10;
</programlisting>
- For clarity we omitted the <function>coalesce</function> function
- which would be needed to search rows that contain <literal>NULL</literal>
+ For clarity we omitted the <function>coalesce</function> function calls
+ which would be needed to find rows that contain <literal>NULL</literal>
in one of the two fields.
</para>
@@ -526,7 +526,7 @@ CREATE INDEX pgweb_idx ON pgweb USING gin(to_tsvector(config_name, body));
Indexes can even concatenate columns:
<programlisting>
-CREATE INDEX pgweb_idx ON pgweb USING gin(to_tsvector('english', title || body));
+CREATE INDEX pgweb_idx ON pgweb USING gin(to_tsvector('english', title || ' ' || body));
</programlisting>
</para>
@@ -540,7 +540,7 @@ CREATE INDEX pgweb_idx ON pgweb USING gin(to_tsvector('english', title || body))
<programlisting>
ALTER TABLE pgweb ADD COLUMN textsearchable_index_col tsvector;
UPDATE pgweb SET textsearchable_index_col =
- to_tsvector('english', coalesce(title,'') || coalesce(body,''));
+ to_tsvector('english', coalesce(title,'') || ' ' || coalesce(body,''));
</programlisting>
Then we create a <acronym>GIN</acronym> index to speed up the search: