Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions pg_textsearch/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# SPDX-FileCopyrightText: Copyright © contributors to CloudNativePG, established as CloudNativePG a Series of LF Projects, LLC.
# SPDX-License-Identifier: Apache-2.0


ARG BASE=ghcr.io/cloudnative-pg/postgresql:18-minimal-trixie
FROM $BASE AS builder

ARG PG_MAJOR
ARG EXT_VERSION
ARG TARGETARCH

USER 0

RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends ca-certificates wget unzip dpkg; \
case "${TARGETARCH}" in amd64|arm64) ;; *) echo "Unsupported TARGETARCH=${TARGETARCH}" >&2; exit 1 ;; esac; \
ZIP_URL="https://github.com/timescale/pg_textsearch/releases/download/v${EXT_VERSION}/pg-textsearch-v${EXT_VERSION}-pg${PG_MAJOR}-${TARGETARCH}.zip"; \
DEB_FILE="pg-textsearch-postgresql-${PG_MAJOR}_${EXT_VERSION}-1_${TARGETARCH}.deb"; \
LICENSE_TGZ_URL="https://github.com/timescale/pg_textsearch/releases/download/v${EXT_VERSION}/pg_textsearch-${EXT_VERSION}.tar.gz"; \
mkdir -p /tmp/pg_textsearch && cd /tmp/pg_textsearch; \
wget -O pg_textsearch.zip "$ZIP_URL"; \
unzip -q pg_textsearch.zip "$DEB_FILE"; \
dpkg-deb -x "./$DEB_FILE" /tmp/pkgroot; \
mkdir -p /out/lib /out/share/extension "/out/licenses/pg-textsearch-postgresql-${PG_MAJOR}"; \
cp -a "/tmp/pkgroot/usr/lib/postgresql/${PG_MAJOR}/lib/pg_textsearch"* /out/lib/; \
cp -a "/tmp/pkgroot/usr/share/postgresql/${PG_MAJOR}/extension/pg_textsearch"* /out/share/extension/; \
wget -qO- "$LICENSE_TGZ_URL" | tar -xzO "pg_textsearch-${EXT_VERSION}/LICENSE" > "/out/licenses/pg-textsearch-postgresql-${PG_MAJOR}/copyright"; \
cd /; \
rm -rf /tmp/pg_textsearch; \
rm -rf /var/lib/apt/lists/*

FROM scratch
ARG PG_MAJOR

COPY --from=builder /out/licenses/pg-textsearch-postgresql-${PG_MAJOR}/copyright /licenses/pg-textsearch-postgresql-${PG_MAJOR}/
COPY --from=builder /out/lib/pg_textsearch* /lib/
COPY --from=builder /out/share/extension/pg_textsearch* /share/extension/

USER 65532:65532
93 changes: 93 additions & 0 deletions pg_textsearch/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# PgTextsearch


[pg_textsearch](https://github.com/timescale/pg_textsearch) is an extension that adds
**ranked full-text search (BM25)** to PostgreSQL.

## Usage

### 1. Add the pg_textsearch extension image to your Cluster

Define the `pg_textsearch` extension under the `postgresql.extensions` section of
your `Cluster` resource. For example:

```yaml
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: cluster-pg-textsearch
spec:
imageName: ghcr.io/cloudnative-pg/postgresql:18-minimal-trixie
instances: 1

storage:
size: 1Gi

postgresql:
extensions:
- name: pg-textsearch
image:
# renovate: suite=trixie-pgdg depName=postgresql-18-pg_textsearch
reference: ghcr.io/cloudnative-pg/pg_textsearch:0.4.1-18-trixie
```

### 2. Enable the extension in a database

You can install `pg_textsearch` in a specific database by creating or updating a
`Database` resource. For example, to enable it in the `app` database:

```yaml
apiVersion: postgresql.cnpg.io/v1
kind: Database
metadata:
name: cluster-pg-textsearch-app
spec:
name: app
owner: app
cluster:
name: cluster-pg-textsearch
extensions:
- name: pg_textsearch
# renovate: suite=trixie-pgdg depName=postgresql-18-pg_textsearch
version: '0.4.1'
```

### 3. Verify installation

Once the database is ready, connect to it with `psql` and run:

```sql
\dx
```

You should see `pg_textsearch` listed among the installed extensions.

## Contributors

This extension is maintained by:

- Bryan Wong (@ImSingee)

The maintainers are responsible for:

- Monitoring upstream releases and security vulnerabilities.
- Ensuring compatibility with supported PostgreSQL versions.
- Reviewing and merging contributions specific to this extension's container
image and lifecycle.

---

## Licenses and Copyright

This container image contains software that may be licensed under various
open-source licenses.

All relevant license and copyright information for the `pg_textsearch` extension
and its dependencies are bundled within the image at:

```text
/licenses/
```

By using this image, you agree to comply with the terms of the licenses
contained therein.
23 changes: 23 additions & 0 deletions pg_textsearch/metadata.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# SPDX-FileCopyrightText: Copyright © contributors to CloudNativePG, established as CloudNativePG a Series of LF Projects, LLC.
# SPDX-License-Identifier: Apache-2.0
metadata = {
name = "pg_textsearch"
sql_name = "pg_textsearch"
image_name = "pg_textsearch"
shared_preload_libraries = []
extension_control_path = []
dynamic_library_path = []
ld_library_path = []
auto_update_os_libs = false

versions = {
trixie = {
// renovate: suite=trixie-pgdg depName=postgresql-18-pg_textsearch
"18" = "0.4.1"
}
bookworm = {
// renovate: suite=bookworm-pgdg depName=postgresql-18-pg_textsearch
"18" = "0.4.1"
}
}
}