Re: Example not producing shown output
Daniel Gustafsson <[email protected]> Mon, 25 Nov 2019 15:23:42 +0100
| Newsgroups | gmane.comp.db.postgresql.devel.documentation |
|---|---|
| Message-ID | <[email protected]> |
> On 25 Nov 2019, at 13:05, PG Doc comments form <[email protected]> wrote: > > The following documentation comment has been logged on the website: > > Page: https://www.postgresql.org/docs/12/functions-textsearch.html > Description: > > Page: https://www.postgresql.org/docs/12/functions-textsearch.html > > Examples should have specified 'english'. > > Instead: > to_tsvector('fat cats ate rats') @@ to_tsquery('cat & rat') > > which returns fale on my own blank installation of Postgre (Serbian locale > Windows OS) instead of true: > to_tsvector('english', 'fat cats ate rats') @@ to_tsquery('cat & rat') I agree with this complaint, mainly since other examples on the page do specify english where required AFAICT, this makes it consistent. The attached diff adds the english configuration directive to @@ and @@@. The examples on chapter 12.1 all have the same issue, but adding 'english' to all of them in order to make them work out of the box everywhere doesn't seem like an improvement to the docs so those are left as is. cheers ./daniel
textsearch_english.diff
(application/octet-stream, 1.2 KB)
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 57a1539506..cc29d2ed47 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -9889,14 +9889,14 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
<entry> <literal>@@</literal> </entry>
<entry><type>boolean</type></entry>
<entry><type>tsvector</type> matches <type>tsquery</type> ?</entry>
- <entry><literal>to_tsvector('fat cats ate rats') @@ to_tsquery('cat & rat')</literal></entry>
+ <entry><literal>to_tsvector('english', 'fat cats ate rats') @@ to_tsquery('english', 'cat & rat')</literal></entry>
<entry><literal>t</literal></entry>
</row>
<row>
<entry> <literal>@@@</literal> </entry>
<entry><type>boolean</type></entry>
<entry>deprecated synonym for <literal>@@</literal></entry>
- <entry><literal>to_tsvector('fat cats ate rats') @@@ to_tsquery('cat & rat')</literal></entry>
+ <entry><literal>to_tsvector('english', 'fat cats ate rats') @@@ to_tsquery('english', 'cat & rat')</literal></entry>
<entry><literal>t</literal></entry>
</row>
<row>