simple_parser
pg_simple_parser · C full-text-search parser that splits input only at ASCII space characters, preserving punctuation such as underscores inside tokens.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100466 | simple_parser | pg_simple_parser | 1.0 | FTS | PostgreSQL | C |
Usage
Sources:
simple_parser 1.0 installs the full-text-search parser simpleparser. It treats every run of bytes between ASCII space characters as one word, preserving punctuation such as underscores and hyphens inside the token.
Create a Text Search Configuration
The extension installs a parser, not a ready-to-use text search configuration. Create one and map its word token type to a dictionary:
The parser also emits a blank token type so PostgreSQL’s standard headline function can retain spacing, but it normally needs no dictionary mapping.
Installed Objects
simpleparseris the public text search parser.simpleprs_start,simpleprs_getlexeme,simpleprs_end, andsimpleprs_lextypeare internal C parser callbacks; call PostgreSQL text-search functions rather than invoking them directly.- The parser reuses PostgreSQL token IDs 3 (
word) and 12 (blank) and delegates headline generation topg_catalog.prsd_headline.
Tokenization Caveats
Only byte value ASCII space (0x20) is a separator. Tabs, newlines, non-breaking spaces, and other Unicode whitespace remain inside a word, as do punctuation and control bytes. The parser does not perform linguistic segmentation, Unicode normalization, case folding, stemming, or stop-word removal; those behaviors come only from the mapped dictionaries.
Inspect actual tokens before indexing application data:
Changing a configuration or dictionary after building a tsvector index requires regenerating stored vectors and rebuilding the affected index. Use this parser only when literal ASCII-space token boundaries match the application’s search semantics.