mirror of
https://github.com/postgres/postgres.git
synced 2025-05-29 16:21:20 +03:00
Since some preparation work had already been done, the only source changes left were changing empty-element tags like <xref linkend="foo"> to <xref linkend="foo"/>, and changing the DOCTYPE. The source files are still named *.sgml, but they are actually XML files now. Renaming could be considered later. In the build system, the intermediate step to convert from SGML to XML is removed. Everything is build straight from the source files again. The OpenSP (or the old SP) package is no longer needed. The documentation toolchain instructions are updated and are much simpler now. Peter Eisentraut, Alexander Lakhin, Jürgen Purtz
86 lines
2.4 KiB
Plaintext
86 lines
2.4 KiB
Plaintext
<!-- doc/src/sgml/dict-int.sgml -->
|
|
|
|
<sect1 id="dict-int" xreflabel="dict_int">
|
|
<title>dict_int</title>
|
|
|
|
<indexterm zone="dict-int">
|
|
<primary>dict_int</primary>
|
|
</indexterm>
|
|
|
|
<para>
|
|
<filename>dict_int</filename> is an example of an add-on dictionary template
|
|
for full-text search. The motivation for this example dictionary is to
|
|
control the indexing of integers (signed and unsigned), allowing such
|
|
numbers to be indexed while preventing excessive growth in the number of
|
|
unique words, which greatly affects the performance of searching.
|
|
</para>
|
|
|
|
<sect2>
|
|
<title>Configuration</title>
|
|
|
|
<para>
|
|
The dictionary accepts two options:
|
|
</para>
|
|
|
|
<itemizedlist>
|
|
<listitem>
|
|
<para>
|
|
The <literal>maxlen</literal> parameter specifies the maximum number of
|
|
digits allowed in an integer word. The default value is 6.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
The <literal>rejectlong</literal> parameter specifies whether an overlength
|
|
integer should be truncated or ignored. If <literal>rejectlong</literal> is
|
|
<literal>false</literal> (the default), the dictionary returns the first
|
|
<literal>maxlen</literal> digits of the integer. If <literal>rejectlong</literal> is
|
|
<literal>true</literal>, the dictionary treats an overlength integer as a stop
|
|
word, so that it will not be indexed. Note that this also means that
|
|
such an integer cannot be searched for.
|
|
</para>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</sect2>
|
|
|
|
<sect2>
|
|
<title>Usage</title>
|
|
|
|
<para>
|
|
Installing the <literal>dict_int</literal> extension creates a text search
|
|
template <literal>intdict_template</literal> and a dictionary <literal>intdict</literal>
|
|
based on it, with the default parameters. You can alter the
|
|
parameters, for example
|
|
|
|
<programlisting>
|
|
mydb# ALTER TEXT SEARCH DICTIONARY intdict (MAXLEN = 4, REJECTLONG = true);
|
|
ALTER TEXT SEARCH DICTIONARY
|
|
</programlisting>
|
|
|
|
or create new dictionaries based on the template.
|
|
</para>
|
|
|
|
<para>
|
|
To test the dictionary, you can try
|
|
|
|
<programlisting>
|
|
mydb# select ts_lexize('intdict', '12345678');
|
|
ts_lexize
|
|
-----------
|
|
{123456}
|
|
</programlisting>
|
|
|
|
but real-world usage will involve including it in a text search
|
|
configuration as described in <xref linkend="textsearch"/>.
|
|
That might look like this:
|
|
|
|
<programlisting>
|
|
ALTER TEXT SEARCH CONFIGURATION english
|
|
ALTER MAPPING FOR int, uint WITH intdict;
|
|
</programlisting>
|
|
|
|
</para>
|
|
</sect2>
|
|
|
|
</sect1>
|