Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitec2ff52

Browse files
committed
Add SGML docs for contrib/dict_int and contrib/dict_xsyn.
Albert Cervera i Areny
1 parent43da837 commitec2ff52

File tree

4 files changed

+162
-2
lines changed

4 files changed

+162
-2
lines changed

‎doc/src/sgml/contrib.sgml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/contrib.sgml,v 1.4 2007/11/14 02:36:43 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/contrib.sgml,v 1.5 2007/12/02 21:13:34 tgl Exp $ -->
22

33
<appendix id="contrib">
44
<title>Additional Supplied Modules</title>
@@ -82,6 +82,8 @@ psql -d dbname -f <replaceable>SHAREDIR</>/contrib/<replaceable>module</>.sql
8282
&chkpass;
8383
&cube;
8484
&dblink;
85+
&dict-int;
86+
&dict-xsyn;
8587
&earthdistance;
8688
&fuzzystrmatch;
8789
&hstore;

‎doc/src/sgml/dict-int.sgml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<sect1 id="dict-int">
2+
<title>dict_int</title>
3+
4+
<indexterm zone="dict-int">
5+
<primary>dict_int</primary>
6+
</indexterm>
7+
8+
<para>
9+
The motivation for this example dictionary is to control the indexing of
10+
integers (signed and unsigned), and, consequently, to minimize the number of
11+
unique words which greatly affect the performance of searching.
12+
</para>
13+
14+
<sect2>
15+
<title>Configuration</title>
16+
<para>
17+
The dictionary accepts two options:
18+
</para>
19+
20+
<itemizedlist>
21+
<listitem>
22+
<para>
23+
The MAXLEN parameter specifies the maximum length (number of digits)
24+
allowed in an integer word. The default value is 6.
25+
</para>
26+
</listitem>
27+
<listitem>
28+
<para>
29+
The REJECTLONG parameter specifies if an overlength integer should be
30+
truncated or ignored. If REJECTLONG=FALSE (default), the dictionary returns
31+
the first MAXLEN digits of the integer. If REJECTLONG=TRUE, the
32+
dictionary treats an overlength integer as a stop word, so that it will
33+
not be indexed.
34+
</para>
35+
</listitem>
36+
</itemizedlist>
37+
</sect2>
38+
39+
<sect2>
40+
<title>Usage</title>
41+
42+
<para>
43+
Running the installation script creates a text search template
44+
<literal>intdict_template</> and a dictionary <literal>intdict</>
45+
based on it, with the default parameters. You can alter the
46+
parameters, for example
47+
48+
<programlisting>
49+
mydb# ALTER TEXT SEARCH DICTIONARY intdict (MAXLEN = 4, REJECTLONG = true);
50+
ALTER TEXT SEARCH DICTIONARY
51+
</programlisting>
52+
53+
or create new dictionaries based on the template.
54+
</para>
55+
56+
<para>
57+
To test the dictionary, you can try
58+
59+
<programlisting>
60+
mydb# select ts_lexize('intdict', '12345678');
61+
ts_lexize
62+
-----------
63+
{123456}
64+
</programlisting>
65+
66+
but real-world usage will involve including it in a text search
67+
configuration as described in <xref linkend="textsearch">.
68+
That might look like this:
69+
70+
<programlisting>
71+
ALTER TEXT SEARCH CONFIGURATION english
72+
ALTER MAPPING FOR int, uint WITH intdict;
73+
</programlisting>
74+
75+
</para>
76+
</sect2>
77+
78+
</sect1>

‎doc/src/sgml/dict-xsyn.sgml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<sect1 id="dict-xsyn">
2+
<title>dict_xsyn</title>
3+
4+
<indexterm zone="dict-xsyn">
5+
<primary>dict_xsyn</primary>
6+
</indexterm>
7+
8+
<para>
9+
The Extended Synonym Dictionary module replaces words with groups of their
10+
synonyms, and so makes it possible to search for a word using any of its
11+
synonyms.
12+
</para>
13+
14+
<sect2>
15+
<title>Configuration</title>
16+
<para>
17+
A <literal>dict_xsyn</> dictionary accepts the following options:
18+
</para>
19+
<itemizedlist>
20+
<listitem>
21+
<para>
22+
KEEPORIG controls whether the original word is included, or only its
23+
synonyms. Default is 'true'.
24+
</para>
25+
</listitem>
26+
<listitem>
27+
<para>
28+
RULES is the base name of the file containing the list of synonyms.
29+
This file must be in $(prefix)/share/tsearch_data/, and its name must
30+
end in ".rules" (which is not included in the RULES parameter).
31+
</para>
32+
</listitem>
33+
</itemizedlist>
34+
<para>
35+
The rules file has the following format:
36+
</para>
37+
<itemizedlist>
38+
<listitem>
39+
<para>
40+
Each line represents a group of synonyms for a single word, which is
41+
given first on the line. Synonyms are separated by whitespace:
42+
</para>
43+
<programlisting>
44+
word syn1 syn2 syn3
45+
</programlisting>
46+
</listitem>
47+
<listitem>
48+
<para>
49+
Sharp ('#') sign is a comment delimiter. It may appear at any position
50+
inside the line. The rest of the line will be skipped.
51+
</para>
52+
</listitem>
53+
</itemizedlist>
54+
55+
<para>
56+
Look at xsyn_sample.rules, which is installed in $(prefix)/share/tsearch_data/,
57+
for an example.
58+
</para>
59+
</sect2>
60+
61+
<sect2>
62+
<title>Usage</title>
63+
<programlisting>
64+
mydb=# SELECT ts_lexize('xsyn','word');
65+
ts_lexize
66+
----------------
67+
{word,syn1,syn2,syn3)
68+
</programlisting>
69+
<para>
70+
Change dictionary options:
71+
</para>
72+
<programlisting>
73+
mydb# ALTER TEXT SEARCH DICTIONARY xsyn (KEEPORIG=false);
74+
ALTER TEXT SEARCH DICTIONARY
75+
</programlisting>
76+
</sect2>
77+
78+
</sect1>

‎doc/src/sgml/filelist.sgml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/filelist.sgml,v 1.53 2007/11/14 01:09:50 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/filelist.sgml,v 1.54 2007/12/02 21:13:34 tgl Exp $ -->
22

33
<!entity history SYSTEM "history.sgml">
44
<!entity info SYSTEM "info.sgml">
@@ -96,6 +96,8 @@
9696
<!entity chkpass SYSTEM "chkpass.sgml">
9797
<!entity cube SYSTEM "cube.sgml">
9898
<!entity dblink SYSTEM "dblink.sgml">
99+
<!entity dict-int SYSTEM "dict-int.sgml">
100+
<!entity dict-xsyn SYSTEM "dict-xsyn.sgml">
99101
<!entity earthdistance SYSTEM "earthdistance.sgml">
100102
<!entity fuzzystrmatch SYSTEM "fuzzystrmatch.sgml">
101103
<!entity hstore SYSTEM "hstore.sgml">

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp