Ignition 8.3+ Gateway Module
A first-of-kind Ignition module that exposes system.pgvector directly in the scripting environment — embedding storage, similarity search, and generation, backed by pgvector on PostgreSQL, with no external service call required.
Why It Exists
Every other path to similarity search from an Ignition gateway means standing up an external service and calling out to it from Jython. This module collapses that into a single native scripting namespace.
Without system.pgvector
With system.pgvector
system.pgvector.* — available wherever gateway scripts runHow It Works
Point at a datasource
Set the Ignition connection name and embedding provider from the gateway web UI at /res/pgvector/index.html. Applies immediately, no restart.
Create the table
ensureTable creates the vector column and an IVFFlat cosine index if they don't already exist — safe to call on every gateway startup.
Embed and upsert
embedAndStore generates the embedding and upserts by ID, non-blocking by default via a 500-task worker queue.
Search by similarity
querySimilar returns nearest neighbours ordered by distance, with a choice of cosine, L2, or inner-product metrics.
Scripting API
Available in gateway event scripts, scheduled scripts, and tag scripts. Not exposed in the Designer or Client Script Console.
ensureTable(connectionName, table, dimension=1536)
Creates the vector table and IVFFlat index if they don't already exist. Safe to call on every gateway startup.
upsertEmbedding(connectionName, table, id, embedding, metadata)
Inserts or updates a vector record via ON CONFLICT (id) DO UPDATE — repeated calls with the same ID overwrite vector and metadata.
querySimilar(connectionName, table, embedding, limit=5, distanceMetric="cosine")
Returns the nearest neighbours to a query vector as a list of {id, distance, metadata} dicts, ordered by distance ascending.
generateEmbedding(text)
Calls the configured embedding provider synchronously and returns the vector. Throws if the provider is set to None.
embedAndStore(connectionName, table, id, text, metadata, async=True)
Generates an embedding for text and upserts it. Async by default via the internal queue; set async=False to block.
deleteEmbedding(connectionName, table, id)
Deletes a single vector record by ID.
Embedding Providers
OpenAI
text-embedding-3-small (1536-dim) or text-embedding-3-large (3072-dim). API key from platform.openai.com.
Azure OpenAI
Endpoint is your resource URL; model is your deployment name. API key from the Azure resource.
Ollama (local)
Points at a local Ollama endpoint — e.g. nomic-embed-text (768-dim). No API key required.
None (manual)
Use upsertEmbedding with your own pre-computed float arrays. generateEmbedding and embedAndStore throw if called.
Distance Metrics
| Metric string | pgvector operator | Use when |
|---|---|---|
| cosine (default) | <=> | Normalized embeddings, semantic similarity |
| l2 / euclidean | <-> | Absolute magnitude matters |
| inner_product / dot | <#> | Already-normalized unit vectors — fastest |
REST API
Routes are mounted at /data/pgvector/. Useful for scripting configuration changes from outside Ignition, or wiring settings into an internal admin tool.
GET /data/pgvector/settings
Installation
Install the pgvector PostgreSQL extension
The install script detects or installs VS 2022 Build Tools, clones pgvector v0.8.3, builds it with nmake, and installs it into your PostgreSQL directory.
scripts\install-pgvector-windows.ps1Install the Ignition module
Copies the built .modl into Ignition's user-lib\modules directory and restarts the service.
scripts\install-module-ignition.ps1Accept the unsigned module
In the Gateway web interface, go to Config → Modules and accept the unsigned module prompt. Then configure the datasource and provider at /res/pgvector/index.html.
Get in touch
Distributed as a free module — no Ignition license required. Happy to walk through the install or the scripting API for a specific use case.