tsearch_extras
tsearch_extras · Full-text-search helpers for returning match locations and extracting tsvector lexemes.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100407 | tsearch_extras | tsearch_extras | 1.0 | FTS | PostgreSQL | C |
PostgreSQL · 10, 11
Usage
Sources:
tsearch_extras version 1.0 exposes lower-level information from PostgreSQL full-text search: locations and lengths of query matches in source text, and the lexemes stored in a tsvector.
Core Workflow
Use an explicit text-search configuration when results must not depend on the session default:
Objects
ts_match_locs_array(text, tsquery) returns int4[][2]: match location/length pairs using the current text-search configuration.ts_match_locs_array(regconfig, text, tsquery) returns int4[][2]: the same result using the selected configuration.tsvector_lexemes(tsvector) returns text[]: lexemes stored in the vector, without positional metadata or weights.
Compatibility Boundary
Match locations are produced through PostgreSQL’s parser and headline internals, so validate offsets with the exact configuration, encoding, dictionary, and server version used by the application. The repository is archived and the C source depends on internal full-text-search headers. Verify compilation and regression behavior for the target PostgreSQL release; no preload is required.