example, normally <literal>!x</literal> matches
only documents that do not contain <literal>x</literal> anywhere.
But <literal>!x <-> y</literal> matches <literal>y</literal> if it is not
immediately after an <literal>x</literal>; an occurrence of <literal>x</literal>
elsewhere in the document does not prevent a match. Another example is
that <literal>x & y</literal> normally only requires that <literal>x</literal>
and <literal>y</literal> both appear somewhere in the document, but
<literal>(x & y) <-> z</literal> requires <literal>x</literal>
and <literal>y</literal> to match at the same place, immediately before
a <literal>z</literal>. Thus this query behaves differently from
<literal>x <-> z & y <-> z</literal>, which will match a
document containing two separate sequences <literal>x z</literal> and
<literal>y z</literal>. (This specific query is useless as written,
since <literal>x</literal> and <literal>y</literal> could not match at the same place;
but with more complex situations such as prefix-match patterns, a query
of this form could be useful.)
</para>
</sect2>
<sect2 id="textsearch-intro-configurations">
<title>Configurations</title>
<para>
The above are all simple text search examples. As mentioned before, full
text search functionality includes the ability to do many more things:
skip indexing certain words (stop words), process synonyms, and use
sophisticated parsing, e.g., parse based on more than just white space.
This functionality is controlled by <firstterm>text search
configurations</firstterm>. <productname>PostgreSQL</productname> comes with predefined
configurations for many languages, and you can easily create your own
configurations. (<application>psql</application>'s <command>\dF</command> command
shows all available configurations.)
</para>
<para>
During installation an appropriate configuration is selected and
<xref linkend="guc-default-text-search-config"/> is set accordingly
in <filename>postgresql.conf</filename>. If you are using the same text search
configuration for the entire cluster you can use the value in
<filename>postgresql.conf</filename>. To use different configurations
throughout the cluster but the same configuration within any one database,
use <command>ALTER DATABASE ... SET</command>. Otherwise, you can set
<varname>default_text_search_config</varname> in each session.
</para>
<para>
Each text search function that depends on a configuration has an optional
<type>regconfig</type> argument, so that the configuration to use can be
specified explicitly. <varname>default_text_search_config</varname>
is used only when this argument is omitted.
</para>
<para>
To make it easier to build custom text search configurations, a
configuration is built up from simpler database objects.
<productname>PostgreSQL</productname>'s text search facility provides
four types of configuration-related database objects:
</para>
<itemizedlist spacing="compact" mark="bullet">
<listitem>
<para>
<firstterm>Text search parsers</firstterm> break documents into tokens
and classify each token (for example, as words or numbers).
</para>
</listitem>
<listitem>
<para>
<firstterm>Text search dictionaries</firstterm> convert tokens to normalized
form and reject stop words.
</para>
</listitem>
<listitem>
<para>
<firstterm>Text search templates</firstterm> provide the functions underlying
dictionaries. (A dictionary simply specifies a template and a set
of parameters for the template.)
</para>
</listitem>
<listitem>
<para>
<firstterm>Text search configurations</firstterm> select a parser and a set
of dictionaries to use to normalize the tokens produced by the parser.
</para>