<replaceable
class="parameter">config</replaceable>,
or <varname>default_text_search_config</varname> if that argument is
omitted.
</para>
<para>
<function>ts_debug</function> returns one row for each token identified in the text
by the parser. The columns returned are
<itemizedlist spacing="compact" mark="bullet">
<listitem>
<para>
<replaceable>alias</replaceable> <type>text</type> — short name of the token type
</para>
</listitem>
<listitem>
<para>
<replaceable>description</replaceable> <type>text</type> — description of the
token type
</para>
</listitem>
<listitem>
<para>
<replaceable>token</replaceable> <type>text</type> — text of the token
</para>
</listitem>
<listitem>
<para>
<replaceable>dictionaries</replaceable> <type>regdictionary[]</type> — the
dictionaries selected by the configuration for this token type
</para>
</listitem>
<listitem>
<para>
<replaceable>dictionary</replaceable> <type>regdictionary</type> — the dictionary
that recognized the token, or <literal>NULL</literal> if none did
</para>
</listitem>
<listitem>
<para>
<replaceable>lexemes</replaceable> <type>text[]</type> — the lexeme(s) produced
by the dictionary that recognized the token, or <literal>NULL</literal> if
none did; an empty array (<literal>{}</literal>) means it was recognized as a
stop word
</para>
</listitem>
</itemizedlist>
</para>
<para>
Here is a simple example:
<screen>
SELECT * FROM ts_debug('english', 'a fat cat sat on a mat - it ate a fat rats');
alias | description | token | dictionaries | dictionary | lexemes
-----------+-----------------+-------+----------------+--------------+---------
asciiword | Word, all ASCII | a | {english_stem} | english_stem | {}
blank | Space symbols | | {} | |
asciiword | Word, all ASCII | fat | {english_stem} | english_stem | {fat}
blank | Space symbols | | {} | |
asciiword | Word, all ASCII | cat | {english_stem} | english_stem | {cat}
blank | Space symbols | | {} | |
asciiword | Word, all ASCII | sat | {english_stem} | english_stem | {sat}
blank | Space symbols | | {} | |
asciiword | Word, all ASCII | on | {english_stem} | english_stem | {}
blank | Space symbols | | {} | |
asciiword | Word, all ASCII | a | {english_stem} | english_stem | {}
blank | Space symbols | | {} | |
asciiword | Word, all ASCII | mat | {english_stem} | english_stem | {mat}
blank | Space symbols | | {} | |
blank | Space symbols | - | {} | |
asciiword | Word, all ASCII | it | {english_stem} | english_stem | {}
blank | Space symbols | | {} | |
asciiword | Word, all ASCII | ate | {english_stem} | english_stem | {ate}
blank | Space symbols | | {} | |
asciiword | Word, all ASCII | a | {english_stem} | english_stem | {}
blank | Space symbols | | {} | |
asciiword | Word, all ASCII | fat | {english_stem} | english_stem | {fat}
blank | Space symbols | | {} | |
asciiword | Word, all ASCII | rats | {english_stem} | english_stem | {rat}
</screen>
</para>
<para>
For a more extensive demonstration, we
first create a <literal>public.english</literal> configuration and
Ispell dictionary for the English language:
</para>
<programlisting>
CREATE TEXT SEARCH CONFIGURATION public.english ( COPY = pg_catalog.english );
CREATE TEXT SEARCH DICTIONARY