dict_xsyn

text search dictionary template for extended synonym processing

Overview

PackageVersionCategoryLicenseLanguage
dict_xsyn1.0FUNCPostgreSQLC
IDExtensionBinLibLoadCreateTrustRelocSchema
4900dict_xsynNoYesNoYesNoNo-
Relateddict_int unaccent pg_similarity smlar pg_summarize pg_search pgroonga pg_bigm

Version

PG18PG17PG16PG15PG14
1.01.01.01.01.0

Install

Note: This is a built-in contrib extension of PostgreSQL

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;

Last Modified 2026-03-12: add pg extension catalog (95749bf)