summaryrefslogtreecommitdiffstats
path: root/doc/src/sgml/html/dict-xsyn.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:19:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:19:15 +0000
commit6eb9c5a5657d1fe77b55cc261450f3538d35a94d (patch)
tree657d8194422a5daccecfd42d654b8a245ef7b4c8 /doc/src/sgml/html/dict-xsyn.html
parentInitial commit. (diff)
downloadpostgresql-13-upstream.tar.xz
postgresql-13-upstream.zip
Adding upstream version 13.4.upstream/13.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'doc/src/sgml/html/dict-xsyn.html')
-rw-r--r--doc/src/sgml/html/dict-xsyn.html97
1 files changed, 97 insertions, 0 deletions
diff --git a/doc/src/sgml/html/dict-xsyn.html b/doc/src/sgml/html/dict-xsyn.html
new file mode 100644
index 0000000..4c8a68c
--- /dev/null
+++ b/doc/src/sgml/html/dict-xsyn.html
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>F.12. dict_xsyn</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="prev" href="dict-int.html" title="F.11. dict_int" /><link rel="next" href="earthdistance.html" title="F.13. earthdistance" /></head><body id="docContent" class="container-fluid col-10"><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">F.12. dict_xsyn</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="dict-int.html" title="F.11. dict_int">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="contrib.html" title="Appendix F. Additional Supplied Modules">Up</a></td><th width="60%" align="center">Appendix F. Additional Supplied Modules</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 13.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="earthdistance.html" title="F.13. earthdistance">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="DICT-XSYN"><div class="titlepage"><div><div><h2 class="title" style="clear: both">F.12. dict_xsyn</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="dict-xsyn.html#id-1.11.7.21.4">F.12.1. Configuration</a></span></dt><dt><span class="sect2"><a href="dict-xsyn.html#id-1.11.7.21.5">F.12.2. Usage</a></span></dt></dl></div><a id="id-1.11.7.21.2" class="indexterm"></a><p>
+ <code class="filename">dict_xsyn</code> (Extended Synonym Dictionary) is an example of an
+ add-on dictionary template for full-text search. This dictionary type
+ replaces words with groups of their synonyms, and so makes it possible to
+ search for a word using any of its synonyms.
+ </p><div class="sect2" id="id-1.11.7.21.4"><div class="titlepage"><div><div><h3 class="title">F.12.1. Configuration</h3></div></div></div><p>
+ A <code class="literal">dict_xsyn</code> dictionary accepts the following options:
+ </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
+ <code class="literal">matchorig</code> controls whether the original word is accepted by
+ the dictionary. Default is <code class="literal">true</code>.
+ </p></li><li class="listitem"><p>
+ <code class="literal">matchsynonyms</code> controls whether the synonyms are
+ accepted by the dictionary. Default is <code class="literal">false</code>.
+ </p></li><li class="listitem"><p>
+ <code class="literal">keeporig</code> controls whether the original word is included in
+ the dictionary's output. Default is <code class="literal">true</code>.
+ </p></li><li class="listitem"><p>
+ <code class="literal">keepsynonyms</code> controls whether the synonyms are included in
+ the dictionary's output. Default is <code class="literal">true</code>.
+ </p></li><li class="listitem"><p>
+ <code class="literal">rules</code> is the base name of the file containing the list of
+ synonyms. This file must be stored in
+ <code class="filename">$SHAREDIR/tsearch_data/</code> (where <code class="literal">$SHAREDIR</code> means
+ the <span class="productname">PostgreSQL</span> installation's shared-data directory).
+ Its name must end in <code class="literal">.rules</code> (which is not to be included in
+ the <code class="literal">rules</code> parameter).
+ </p></li></ul></div><p>
+ The rules file has the following format:
+ </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
+ Each line represents a group of synonyms for a single word, which is
+ given first on the line. Synonyms are separated by whitespace, thus:
+</p><pre class="programlisting">
+word syn1 syn2 syn3
+</pre><p>
+ </p></li><li class="listitem"><p>
+ The sharp (<code class="literal">#</code>) sign is a comment delimiter. It may appear at
+ any position in a line. The rest of the line will be skipped.
+ </p></li></ul></div><p>
+ Look at <code class="filename">xsyn_sample.rules</code>, which is installed in
+ <code class="filename">$SHAREDIR/tsearch_data/</code>, for an example.
+ </p></div><div class="sect2" id="id-1.11.7.21.5"><div class="titlepage"><div><div><h3 class="title">F.12.2. Usage</h3></div></div></div><p>
+ Installing the <code class="literal">dict_xsyn</code> extension creates a text search
+ template <code class="literal">xsyn_template</code> and a dictionary <code class="literal">xsyn</code>
+ based on it, with default parameters. You can alter the
+ parameters, for example
+
+</p><pre class="programlisting">
+mydb# ALTER TEXT SEARCH DICTIONARY xsyn (RULES='my_rules', KEEPORIG=false);
+ALTER TEXT SEARCH DICTIONARY
+</pre><p>
+
+ or create new dictionaries based on the template.
+ </p><p>
+ To test the dictionary, you can try
+
+</p><pre class="programlisting">
+mydb=# SELECT ts_lexize('xsyn', 'word');
+ ts_lexize
+-----------------------
+ {syn1,syn2,syn3}
+
+mydb# ALTER TEXT SEARCH DICTIONARY xsyn (RULES='my_rules', KEEPORIG=true);
+ALTER TEXT SEARCH DICTIONARY
+
+mydb=# SELECT ts_lexize('xsyn', 'word');
+ ts_lexize
+-----------------------
+ {word,syn1,syn2,syn3}
+
+mydb# ALTER TEXT SEARCH DICTIONARY xsyn (RULES='my_rules', KEEPORIG=false, MATCHSYNONYMS=true);
+ALTER TEXT SEARCH DICTIONARY
+
+mydb=# SELECT ts_lexize('xsyn', 'syn1');
+ ts_lexize
+-----------------------
+ {syn1,syn2,syn3}
+
+mydb# ALTER TEXT SEARCH DICTIONARY xsyn (RULES='my_rules', KEEPORIG=true, MATCHORIG=false, KEEPSYNONYMS=false);
+ALTER TEXT SEARCH DICTIONARY
+
+mydb=# SELECT ts_lexize('xsyn', 'syn1');
+ ts_lexize
+-----------------------
+ {word}
+</pre><p>
+
+ Real-world usage will involve including it in a text search
+ configuration as described in <a class="xref" href="textsearch.html" title="Chapter 12. Full Text Search">Chapter 12</a>.
+ That might look like this:
+
+</p><pre class="programlisting">
+ALTER TEXT SEARCH CONFIGURATION english
+ ALTER MAPPING FOR word, asciiword WITH xsyn, english_stem;
+</pre><p>
+
+ </p></div></div><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navfooter"><hr></hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="dict-int.html" title="F.11. dict_int">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="contrib.html" title="Appendix F. Additional Supplied Modules">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="earthdistance.html" title="F.13. earthdistance">Next</a></td></tr><tr><td width="40%" align="left" valign="top">F.11. dict_int </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 13.4 Documentation">Home</a></td><td width="40%" align="right" valign="top"> F.13. earthdistance</td></tr></table></div></body></html> \ No newline at end of file