tsp_semantic_headline
tsp_semantic_headline · Phrase highlighting and improved semantics for ts_headline
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 101193 | tsp_semantic_headline | tsp_semantic_headline | 1.0 | FTS | GPL-3.0 | SQL |
PostgreSQL · 14, 15, 16, 17, 18
| Relationships | |
|---|---|
| Requires | unaccent |
Usage
Sources:
tsp_semantic_headline is a pure-SQL experiment for phrase-aware full-text highlighting. It supplies TS_SEMANTIC_HEADLINE, preprocessed query/vector helpers, and TS_FAST_HEADLINE, which can use aligned precomputed TSVECTOR and text[] columns for faster recall.
Use the same preprocessing for indexed text, recall arrays, and queries; otherwise token positions diverge and highlights are wrong. The fast path trades extra stored columns and update work for lower runtime cost. Reproduce performance claims with your language, corpus, query shapes, and options.
Upstream calls the project in development and documents unimplemented options. Its special-character treatment inserts separators and explicitly warns that space-based assumptions can change or destroy meaning in many languages. Treat highlighted output as presentation, escape it for the destination UI, and never mark untrusted HTML as safe. Test stemming, negation, phrase distance, punctuation, Unicode, XSS, long documents, and divergence after content updates.