entire section, per Peter.
-<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.208 2007/08/29 20:37:14 momjian Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.209 2007/08/31 04:52:29 momjian Exp $ -->
<chapter id="datatype">
<title id="datatype-title">Data Types</title>
<variablelist>
- <indexterm zone="datatype-textsearch">
- <primary>tsvector</primary>
- </indexterm>
-
<varlistentry>
<term><firstterm>tsvector</firstterm></term>
<listitem>
<para>
- <type>tsvector</type> is a data type that represents a document and is
- optimized for full text searching. In the simplest case,
- <type>tsvector</type> is a sorted list of lexemes, so even without indexes
- full text searches perform better than standard <literal>~</literal> and
- <literal>LIKE</literal> operations:
+ <type>tsvector</type>
+ <indexterm><primary>tsvector</primary></indexterm> is a data type
+ that represents a document and is optimized for full text searching.
+ In the simplest case, <type>tsvector</type> is a sorted list of
+ lexemes, so even without indexes full text searches perform better
+ than standard <literal>~</literal> and <literal>LIKE</literal>
+ operations:
<programlisting>
SELECT 'a fat cat sat on a mat and ate a fat rat'::tsvector;
</varlistentry>
- <indexterm zone="datatype-textsearch">
- <primary>tsquery</primary>
- </indexterm>
-
<varlistentry>
<term><firstterm>tsquery</firstterm></term>
<listitem>
<para>
- <type>tsquery</type> is a data type for textual queries which supports
- the boolean operators <literal>&</literal> (AND), <literal>|</literal> (OR),
- and parentheses. A <type>tsquery</type> consists of lexemes
- (optionally labeled by letters) with boolean operators in between:
+ <type>tsquery</type>
+ <indexterm><primary>tsquery</primary></indexterm> is a data type
+ for textual queries which supports the boolean operators
+ <literal>&</literal> (AND), <literal>|</literal> (OR), and
+ parentheses. A <type>tsquery</type> consists of lexemes (optionally
+ labeled by letters) with boolean operators in between:
<programlisting>
SELECT 'fat & cat'::tsquery;
-<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.390 2007/08/29 21:51:45 momjian Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.391 2007/08/31 04:52:29 momjian Exp $ -->
<chapter id="functions">
<title>Functions and Operators</title>
<varlistentry>
- <indexterm zone="functions-textsearch-search-operator">
- <primary>TSVECTOR @@ TSQUERY</primary>
+ <indexterm>
+ <primary>TSVECTOR @@ TSQUERY</primary>
</indexterm>
<term>
<varlistentry>
- <indexterm zone="functions-textsearch-search-operator">
- <primary>TEXT @@ TSQUERY</primary>
+ <indexterm>
+ <primary>TEXT @@ TSQUERY</primary>
</indexterm>
<term>
<varlistentry>
- <indexterm zone="functions-textsearch-search-operator">
- <primary>TEXT @@ TEXT</primary>
+ <indexterm>
+ <primary>TEXT @@ TEXT</primary>
</indexterm>
<term>
<varlistentry>
- <indexterm zone="functions-textsearch-tsvector">
- <primary>to_tsvector</primary>
+ <indexterm>
+ <primary>to_tsvector</primary>
</indexterm>
<term>
<varlistentry>
- <indexterm zone="functions-textsearch-tsvector">
- <primary>strip</primary>
+ <indexterm>
+ <primary>strip</primary>
</indexterm>
<term>
<varlistentry>
- <indexterm zone="functions-textsearch-tsvector">
- <primary>setweight</primary>
+ <indexterm>
+ <primary>setweight</primary>
</indexterm>
<term>
<varlistentry>
- <indexterm zone="functions-textsearch-tsvector">
- <primary>tsvector concatenation</primary>
+ <indexterm>
+ <primary>tsvector concatenation</primary>
</indexterm>
<term>
<varlistentry>
- <indexterm zone="functions-textsearch-tsvector">
- <primary>length(tsvector)</primary>
+ <indexterm>
+ <primary>length(tsvector)</primary>
</indexterm>
<term>
<varlistentry>
- <indexterm zone="functions-textsearch-tsvector">
- <primary>text::tsvector</primary>
+ <indexterm>
+ <primary>text::tsvector</primary>
</indexterm>
<term>
<varlistentry>
- <indexterm zone="functions-textsearch-tsvector">
- <primary>trigger</primary>
- <secondary>for updating a derived tsvector column</secondary>
+ <indexterm>
+ <primary>trigger</primary>
+ <secondary>for updating a derived tsvector column</secondary>
</indexterm>
<term>
<varlistentry>
- <indexterm zone="functions-textsearch-tsvector">
- <primary>ts_stat</primary>
+ <indexterm>
+ <primary>ts_stat</primary>
</indexterm>
<term>
<varlistentry>
- <indexterm zone="functions-textsearch-tsvector">
- <primary>Btree operations for tsvector</primary>
+ <indexterm>
+ <primary>Btree operations for tsvector</primary>
</indexterm>
<term>
<varlistentry>
- <indexterm zone="functions-textsearch-tsquery">
- <primary>to_tsquery</primary>
+ <indexterm>
+ <primary>to_tsquery</primary>
</indexterm>
<term>
<varlistentry>
- <indexterm zone="functions-textsearch-tsquery">
- <primary>plainto_tsquery</primary>
+ <indexterm>
+ <primary>plainto_tsquery</primary>
</indexterm>
<term>
<varlistentry>
- <indexterm zone="functions-textsearch-tsquery">
- <primary>querytree</primary>
+ <indexterm>
+ <primary>querytree</primary>
</indexterm>
<term>
<varlistentry>
- <indexterm zone="functions-textsearch-tsquery">
- <primary>text::tsquery casting</primary>
+ <indexterm>
+ <primary>text::tsquery casting</primary>
</indexterm>
<term>
<varlistentry>
- <indexterm zone="functions-textsearch-tsquery">
- <primary>numnode</primary>
+ <indexterm>
+ <primary>numnode</primary>
</indexterm>
<term>
<varlistentry>
- <indexterm zone="functions-textsearch-tsquery">
- <primary>TSQUERY && TSQUERY</primary>
+ <indexterm>
+ <primary>TSQUERY && TSQUERY</primary>
</indexterm>
<term>
<varlistentry>
- <indexterm zone="functions-textsearch-tsquery">
- <primary>TSQUERY || TSQUERY</primary>
+ <indexterm>
+ <primary>TSQUERY || TSQUERY</primary>
</indexterm>
<term>
<varlistentry>
- <indexterm zone="functions-textsearch-tsquery">
- <primary>!! TSQUERY</primary>
+ <indexterm>
+ <primary>!! TSQUERY</primary>
</indexterm>
<term>
<varlistentry>
- <indexterm zone="functions-textsearch-tsquery">
- <primary>Btree operations for tsquery</primary>
+ <indexterm>
+ <primary>Btree operations for tsquery</primary>
</indexterm>
<term>
<varlistentry>
- <indexterm zone="functions-textsearch-tsquery">
- <primary>ts_rewrite</primary>
+ <indexterm>
+ <primary>ts_rewrite</primary>
</indexterm>
<term>
<varlistentry>
- <indexterm zone="functions-textsearch-tsquery">
- <primary>TSQUERY @> TSQUERY</primary>
+ <indexterm>
+ <primary>TSQUERY @> TSQUERY</primary>
</indexterm>
<term>
<varlistentry>
- <indexterm zone="functions-textsearch-tsquery">
- <primary>tsquery <@ tsquery</primary>
+ <indexterm>
+ <primary>tsquery <@ tsquery</primary>
</indexterm>
<term>
<title>Configurations</title>
<indexterm zone="textsearch-configurations">
- <primary>text search</primary>
- <secondary>configurations</secondary>
+ <primary>text search</primary>
+ <secondary>configurations</secondary>
</indexterm>
<para>
<sect2 id="textsearch-parser">
<title>Parsing</title>
+ <indexterm zone="textsearch-parser">
+ <primary>text search</primary>
+ <secondary>parse</secondary>
+ </indexterm>
+
<para>
Full text searching in <productname>PostgreSQL</productname> provides
function <function>to_tsvector</function>, which converts a document to
<varlistentry>
- <indexterm zone="textsearch-parser">
- <primary>text search</primary>
- <secondary>parse</secondary>
- </indexterm>
-
<term>
<synopsis>
ts_parse(<replaceable class="PARAMETER">parser</replaceable>, <replaceable class="PARAMETER">document</replaceable> TEXT) returns SETOF <type>tokenout</type>
<varlistentry>
<indexterm zone="textsearch-parser">
- <primary>text search</primary>
- <secondary>ts_token_type</secondary>
+ <primary>text search</primary>
+ <secondary>ts_token_type</secondary>
</indexterm>
<term>
<varlistentry>
<indexterm zone="textsearch-ranking">
- <primary>text search</primary>
- <secondary>ts_rank</secondary>
+ <primary>text search</primary>
+ <secondary>ts_rank</secondary>
</indexterm>
<term>
<varlistentry>
<indexterm zone="textsearch-ranking">
- <primary>text search</primary>
- <secondary>ts_rank_cd</secondary>
+ <primary>text search</primary>
+ <secondary>ts_rank_cd</secondary>
</indexterm>
<term>
<title>Highlighting Results</title>
<indexterm zone="textsearch-headline">
- <primary>text search</primary>
- <secondary>headline</secondary>
+ <primary>text search</primary>
+ <secondary>headline</secondary>
</indexterm>
<para>
<varlistentry>
<indexterm zone="textsearch-dictionaries">
- <primary>text search</primary>
- <secondary>ts_lexize</secondary>
+ <primary>text search</primary>
+ <secondary>ts_lexize</secondary>
</indexterm>
<term>
<varlistentry>
<indexterm zone="textsearch-indexes">
- <primary>text search</primary>
- <secondary>GiST</secondary>
+ <primary>text search</primary>
+ <secondary>GiST</secondary>
</indexterm>
<!--
<indexterm zone="textsearch-indexes">
- <primary>GiST</primary>
+ <primary>GiST</primary>
</indexterm>
-->
<term>
<varlistentry>
<indexterm zone="textsearch-indexes">
- <primary>text search</primary>
- <secondary>GIN</secondary>
+ <primary>text search</primary>
+ <secondary>GIN</secondary>
</indexterm>
<!--
<indexterm zone="textsearch-indexes">
- <primary>GIN</primary>
+ <primary>GIN</primary>
</indexterm>
-->
<term>