dict_translate
dict_translate · Text search dictionary template that normalizes lexemes and expands them to configured translations.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100289 | dict_translate | dict_translate | 1.0 | FTS | Unknown | C |
Usage
Sources:
dict_translate 1.0 provides the translate full-text-search dictionary template. It normalizes an input token with another dictionary and expands it to the translation group stored in a server-side .trn file, making translated terms searchable as equivalent lexemes.
Core Workflow
Create a translation file such as $SHAREDIR/tsearch_data/test_trn.trn on every database server that can execute the configuration:
Install the extension and build a dictionary and configuration around that file:
DictFile names the translation file without its .trn suffix. Each line starts with a source lexeme followed by the lexemes that should be emitted with it. InputDict identifies the dictionary used to normalize the input before translation lookup.
Important Objects
translateis the text search template installed by the extension.dtrn_init(internal)initializes a dictionary fromDictFileandInputDictoptions.dtrn_lexize(internal, internal, internal, internal)performs normalization and translation expansion for the text-search subsystem.
Operational Notes
The .trn file is filesystem configuration, not database data; deploy and version it consistently across primaries, standbys, and replacement hosts. Changing the file does not rewrite existing tsvector values, so stored vectors or indexes must be refreshed when translation rules change. Use a trusted normalization dictionary and test stemming behavior in both indexing and query configurations.