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

Commitc1c40e5

Browse files
committed
Fix textsearch documentation examples to not recommend concatenating separate
fields without putting a space between. Per gripe from Rick Schumeyer.
1 parent1d97c19 commitc1c40e5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

‎doc/src/sgml/textsearch.sgml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/textsearch.sgml,v 1.49 2009/04/14 00:49:56 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/textsearch.sgml,v 1.50 2009/04/19 20:36:06 tgl Exp $ -->
22

33
<chapter id="textsearch">
44
<title id="textsearch-title">Full Text Search</title>
@@ -454,12 +454,12 @@ WHERE to_tsvector(body) @@ to_tsquery('friend');
454454
<programlisting>
455455
SELECT title
456456
FROM pgweb
457-
WHERE to_tsvector(title || body) @@ to_tsquery('create &amp; table')
457+
WHERE to_tsvector(title ||' ' ||body) @@ to_tsquery('create &amp; table')
458458
ORDER BY last_mod_date DESC LIMIT 10;
459459
</programlisting>
460460

461-
For clarity we omitted the <function>coalesce</function> function
462-
which would be needed tosearch rows that contain <literal>NULL</literal>
461+
For clarity we omitted the <function>coalesce</function> function calls
462+
which would be needed tofind rows that contain <literal>NULL</literal>
463463
in one of the two fields.
464464
</para>
465465

@@ -526,7 +526,7 @@ CREATE INDEX pgweb_idx ON pgweb USING gin(to_tsvector(config_name, body));
526526
Indexes can even concatenate columns:
527527

528528
<programlisting>
529-
CREATE INDEX pgweb_idx ON pgweb USING gin(to_tsvector('english', title || body));
529+
CREATE INDEX pgweb_idx ON pgweb USING gin(to_tsvector('english', title ||' ' ||body));
530530
</programlisting>
531531
</para>
532532

@@ -540,7 +540,7 @@ CREATE INDEX pgweb_idx ON pgweb USING gin(to_tsvector('english', title || body))
540540
<programlisting>
541541
ALTER TABLE pgweb ADD COLUMN textsearchable_index_col tsvector;
542542
UPDATE pgweb SET textsearchable_index_col =
543-
to_tsvector('english', coalesce(title,'') || coalesce(body,''));
543+
to_tsvector('english', coalesce(title,'') ||' ' ||coalesce(body,''));
544544
</programlisting>
545545

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp