Skip to content

dict_xsyn

text search dictionary template for extended synonym processing

dict_xsyn · text search dictionary template for extended synonym processing

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
4900dict_xsyndict_xsyn1.0FUNCPostgreSQLC
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d-rNoYesNoYesyesno

Packages

PG19PG18PG17PG16PG15
1.01.01.01.01.0
This contrib extension ships with PostgreSQL.

Install

Create this extension with:

CREATE EXTENSION dict_xsyn;

Usage

dict_xsyn: extended synonym dictionary for text search

Provides an extended synonym dictionary template for text search, replacing words with groups of synonyms.

CREATE EXTENSION dict_xsyn;

Configuration Parameters

ParameterDescriptionDefault
matchorigAccept original wordtrue
matchsynonymsAccept synonyms as inputfalse
keeporigInclude original in outputtrue
keepsynonymsInclude synonyms in outputtrue
rulesBase name of synonym file in $SHAREDIR/tsearch_data/ (.rules extension)–

Rules File Format

word syn1 syn2 syn3

Lines starting with # are comments.

Examples

-- Configure the dictionary
ALTER TEXT SEARCH DICTIONARY xsyn (RULES='my_rules', KEEPORIG=true);

-- Test the dictionary
SELECT ts_lexize('xsyn', 'word');
-- {word,syn1,syn2,syn3}

-- Match synonyms as input too
ALTER TEXT SEARCH DICTIONARY xsyn (RULES='my_rules', MATCHSYNONYMS=true);
SELECT ts_lexize('xsyn', 'syn1');
-- {syn1,syn2,syn3}

-- Use in a text search configuration
ALTER TEXT SEARCH CONFIGURATION english
  ALTER MAPPING FOR word, asciiword WITH xsyn, english_stem;

Table reader