pg_tsparser
pg_tsparser · Parser for PostgreSQL text search
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100110 | pg_tsparser | pg_tsparser | 1.0 | FTS | PostgreSQL | C |
Usage
Sources:
pg_tsparser provides the tsparser full-text parser, a modified PostgreSQL 9.6 default parser that additionally emits underscore-linked words and mixed letter/number hyphenated words as whole tokens. Use it to make identifiers such as pg_trgm or 123-abc searchable without losing their components.
Create a Configuration
Installing the extension creates the parser but not a complete text search configuration. Map its token types to dictionaries explicitly:
Compare tokenization before adopting the configuration:
Object Index
tsparseris the text search parser.tsparser_start(),tsparser_nexttoken(),tsparser_end(),tsparser_lextype(), andtsparser_headline()implement the parser callbacks.
Caveats
The implementation is forked from PostgreSQL 9.6 parser internals, so binary/source compatibility must be verified for every target major version. Extra whole-word tokens change positions, ranking, phrase behavior, index size, and query results; rebuild dependent tsvector columns and indexes after configuration changes. Test punctuation, version strings, paths, URLs, email, non-ASCII text, stemming, dictionaries, headlines, and phrase queries against a representative corpus before replacing an existing configuration.