diff options
author | Tom Lane | 2009-04-19 20:36:06 +0000 |
---|---|---|
committer | Tom Lane | 2009-04-19 20:36:06 +0000 |
commit | 9b0f832a1fb6f637eda506307210416fba7771ac (patch) | |
tree | b40c843d61105a149d4710e749a34770df978905 | |
parent | 37707776e0c1b8cb08230fae6ba3c2130050ef8d (diff) |
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.sgml | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/doc/src/sgml/textsearch.sgml b/doc/src/sgml/textsearch.sgml index d8cbe207a6..b912b6f991 100644 --- a/doc/src/sgml/textsearch.sgml +++ b/doc/src/sgml/textsearch.sgml @@ -454,12 +454,12 @@ WHERE to_tsvector(body) @@ to_tsquery('friend'); <programlisting> SELECT title FROM pgweb -WHERE to_tsvector(title || body) @@ to_tsquery('create & table') +WHERE to_tsvector(title || ' ' || body) @@ to_tsquery('create & 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: |