Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d65ebe9

Browse files
author
Liudmila Mantrova
committed
DOC: SGML documentation for pg_tsparser
1 parent 9acc12b commit d65ebe9

File tree

3 files changed

+92
-0
lines changed

3 files changed

+92
-0
lines changed

doc/src/sgml/contrib.sgml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ CREATE EXTENSION <replaceable>module_name</> FROM unpackaged;
143143
&pgstatstatements;
144144
&pgstattuple;
145145
&pgtrgm;
146+
&pg-tsparser;
146147
&pgvariables;
147148
&pgvisibility;
148149
&plantuner;

doc/src/sgml/filelist.sgml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@
149149
<!ENTITY pgstatstatements SYSTEM "pgstatstatements.sgml">
150150
<!ENTITY pgstattuple SYSTEM "pgstattuple.sgml">
151151
<!ENTITY pgtrgm SYSTEM "pgtrgm.sgml">
152+
<!ENTITY pg-tsparser SYSTEM "pg_tsparser.sgml">
152153
<!ENTITY pgvariables SYSTEM "pg_variables.sgml">
153154
<!ENTITY pgvisibility SYSTEM "pgvisibility.sgml">
154155
<!ENTITY postgres-fdw SYSTEM "postgres-fdw.sgml">

doc/src/sgml/pg_tsparser.sgml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<sect1 id="pg-tsparser">
2+
<title>pg_tsparser</title>
3+
<para>
4+
The <filename>pg_tsparser</filename> is a Postgres Pro extension that
5+
modifies the default text search parser. In addition to the default
6+
search results, this extension also returns a single word in the
7+
following cases:
8+
</para>
9+
<itemizedlist spacing="compact">
10+
<listitem>
11+
<para>
12+
words that include underscores
13+
</para>
14+
</listitem>
15+
<listitem>
16+
<para>
17+
words that include numbers and letters separated by the hyphen
18+
character
19+
</para>
20+
</listitem>
21+
</itemizedlist>
22+
<sect2 id="pg-tsparser-install">
23+
<title>Installation and Setup</title>
24+
<para>
25+
The <filename>pg_tsparser</filename> extension is included into the
26+
Postgres Pro. To enable <filename>pg_tsparser</filename>,
27+
create the <filename>pg_tsparser</filename> extension for each
28+
database you are planning to use:
29+
</para>
30+
<programlisting>
31+
CREATE EXTENSION pg_tsparser;
32+
</programlisting>
33+
<para>
34+
Once <filename>pg_tsparser</filename> is enabled, you can create
35+
your own text search configuration. For example:
36+
</para>
37+
<programlisting>
38+
CREATE TEXT SEARCH CONFIGURATION english_ts (
39+
PARSER = tsparser
40+
);
41+
42+
COMMENT ON TEXT SEARCH CONFIGURATION english_ts IS 'text search configuration for english language';
43+
44+
ALTER TEXT SEARCH CONFIGURATION english_ts
45+
ADD MAPPING FOR email, file, float, host, hword_numpart, int,
46+
numhword, numword, sfloat, uint, url, url_path, version
47+
WITH simple;
48+
49+
ALTER TEXT SEARCH CONFIGURATION english_ts
50+
ADD MAPPING FOR asciiword, asciihword, hword_asciipart,
51+
word, hword, hword_part
52+
WITH english_stem;
53+
</programlisting>
54+
</sect2>
55+
<sect2 id="pg-tsparser-examples">
56+
<title>Examples</title>
57+
<para>
58+
The following examples illustrate the difference in search results
59+
returned by <filename>pg_tsparser</filename> and the default parser:
60+
</para>
61+
<programlisting>
62+
SELECT to_tsvector('english', 'pg_trgm') as def_parser,
63+
to_tsvector('english_ts', 'pg_trgm') as new_parser;
64+
def_parser | new_parser
65+
-----------------+-----------------------------
66+
'pg':1 'trgm':2 | 'pg':2 'pg_trgm':1 'trgm':3
67+
(1 row)
68+
69+
SELECT to_tsvector('english', '123-abc') as def_parser,
70+
to_tsvector('english_ts', '123-abc') as new_parser;
71+
def_parser | new_parser
72+
-----------------+-----------------------------
73+
'123':1 'abc':2 | '123':2 '123-abc':1 'abc':3
74+
(1 row)
75+
76+
SELECT to_tsvector('english', 'rel-3.2-A') as def_parser,
77+
to_tsvector('english_ts', 'rel-3.2-A') as new_parser;
78+
def_parser | new_parser
79+
------------------+-------------------------------
80+
'-3.2':2 'rel':1 | '3.2':3 'rel':2 'rel-3.2-a':1
81+
(1 row)
82+
</programlisting>
83+
</sect2>
84+
<sect2 id="pg-tsparser-authors">
85+
<title>Authors</title>
86+
<para>
87+
Postgres Professional, Moscow, Russia
88+
</para>
89+
</sect2>
90+
</sect1>

0 commit comments

Comments
 (0)