postgres/contrib/dict_xsyn
Bruce Momjian f6e8730d11 Re-run pgindent with updated list of typedefs. (Updated README should
avoid this problem in the future.)
2007-11-15 22:25:18 +00:00
..
expected Add sample text search dictionary templates and parsers, to replace the 2007-10-15 21:36:50 +00:00
sql Add sample text search dictionary templates and parsers, to replace the 2007-10-15 21:36:50 +00:00
Makefile Teach pgxs.mk and Install.pm how to install files from a contrib module 2007-10-16 16:00:00 +00:00
README.dict_xsyn Add sample text search dictionary templates and parsers, to replace the 2007-10-15 21:36:50 +00:00
dict_xsyn.c Re-run pgindent with updated list of typedefs. (Updated README should 2007-11-15 22:25:18 +00:00
dict_xsyn.sql.in Add CVS version labels to all install/uninstall scripts. 2007-11-13 04:24:29 +00:00
uninstall_dict_xsyn.sql Add CVS version labels to all install/uninstall scripts. 2007-11-13 04:24:29 +00:00
xsyn_sample.rules Add sample text search dictionary templates and parsers, to replace the 2007-10-15 21:36:50 +00:00

README.dict_xsyn

Extended Synonym dictionary
===========================

This is a simple synonym dictionary. It replaces words with groups of their
synonyms, and so makes it possible to search for a word using any of its
synonyms.

* Configuration

It accepts the following options:
 
 - KEEPORIG controls whether the original word is included, or only its
   synonyms. Default is 'true'.

 - RULES is the base name of the file containing the list of synonyms.
   This file must be in $(prefix)/share/tsearch_data/, and its name must
   end in ".rules" (which is not included in the RULES parameter).

The rules file has the following format:

 - Each line represents a group of synonyms for a single word, which is
   given first on the line. Synonyms are separated by whitespace:
   
   word syn1 syn2 syn3

 - Sharp ('#') sign is a comment delimiter. It may appear at any position
   inside the line.  The rest of the line will be skipped.

Look at xsyn_sample.rules, which is installed in $(prefix)/share/tsearch_data/,
for an example.

* Usage

1. Compile and install

2. Load dictionary

   psql mydb < dict_xsyn.sql

3. Test it
 
   mydb=# SELECT ts_lexize('xsyn','word');
   ts_lexize
   ----------------
   {word,syn1,syn2,syn3)

4. Change the dictionary options as you wish

   mydb# ALTER TEXT SEARCH DICTIONARY xsyn (KEEPORIG=false);
   ALTER TEXT SEARCH DICTIONARY

That's all.