Skip to content

content_utils

Utility functions for news management and full-text search.

pg_content_utils · Utility functions for news management and full-text search.

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
100396content_utilspg_content_utils1.0.0FTSGPL-2.0SQL
Relationships
Requiresfile_fdw

Usage

Sources:

content_utils provides small SQL helpers for unusual-word scoring, age-based ranking, and protocol-relative URLs. Version 1.0.0 also imports the server’s system dictionary through file_fdw, so installation depends on a specific server-side file layout.

Core Workflow

Install file_fdw first and verify that /usr/share/dict/words exists and is readable by PostgreSQL before creating the extension:

CREATE EXTENSION file_fdw;
CREATE EXTENSION content_utils;

SELECT count_unusual('ordinary quuxword');
SELECT match_unusual('ordinary quuxword');
SELECT reify_url(true, '//example.com/path');

The extension creates the dictionary_word_files foreign server, the words_fdt foreign table, and the materialized view words. Refresh the snapshot explicitly after the dictionary file changes:

REFRESH MATERIALIZED VIEW words;

Functions and Caveats

count_unusual(text) counts terms absent from the dictionary, while match_unusual(text) reports whether such a term exists. rank_modifier(interval) and its timestamp overload compute a week-based score. reify_url(boolean, varchar) prefixes a protocol-relative URL with either HTTPS or HTTP.

The control file does not declare file_fdw as an automatic dependency, and installation fails when the hard-coded dictionary file is absent, unreadable, or incompatible with the expected single-column format. The materialized view is not updated automatically. Test zero-length and future intervals before relying on rank_modifier(interval), because its calculation divides by a rounded number of elapsed weeks.

Table reader