Skip to content

tsexample

Example C extension that defines a custom full-text parser, dictionary template, dictionary, and text-search configuration.

tsexample · Example C extension that defines a custom full-text parser, dictionary template, dictionary, and text-search configuration.

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
100070tsexampletsexample1.0FTSUnknownC

Usage

Sources:

tsexample 1.0 is a compact C example of PostgreSQL’s extensible full-text-search interfaces. It installs the sample_parser parser, the cutdict dictionary template, a cut3 dictionary, and the sample text-search configuration.

Inspect parsing and lexemes

CREATE EXTENSION tsexample;

SELECT * FROM ts_parse('sample_parser', 'abc def 123 1xx yy3');
SELECT to_tsvector('sample', 'abcdef 12345678 xyz');
SELECT plainto_tsquery('sample', 'abcdef 12345678 xyz');

sample_parser groups letters, digits, and underscore characters into tokens, classifying an all-digit token as number and any token containing a non-digit as word. The sample configuration maps numbers through PostgreSQL’s simple dictionary and words through cut3. cut3 lowercases a word and, for longer inputs, emits lexemes made from its first three and last three characters.

Example status

This project is instructional code, not a general linguistic analyzer. Its fixed object names and three-character dictionary settings are examples to adapt rather than a complete search design. The repository supplies no README, explicit license file, release history, or compatibility matrix. Build and test the C module against the exact PostgreSQL major version, and use distinct object names if incorporating the pattern into another extension.

Table reader