OptionalapiKey: stringProtectedColocatedThe host relational connection a colocated provider borrows to store and query
vectors in the same database as the application's entity data. undefined until
SetColocatedHost (or TryWireColocatedHost) is called.
ProtectedApiOnly sub-classes can access the API key
Vectors live in entity rows written by BaseEntity saves; this driver never ingests, so
ingestion pipelines should skip it instead of logging an "unsupported" error per batch.
In-memory driver — there is no index object to provision. The MJ: Vector Indexes row
is the whole definition, and CreateIndex correctly reports success: false. Callers
must not read that as a failed provisioning attempt.
Whether this provider's QueryIndex/HybridQuery params.id is the EntityDocumentID
(a GUID) rather than an external/logical index name. External services (Pinecone, Qdrant)
and DB-colocated providers key by an index name and return false (the default). The
in-process SimpleVectorServiceProvider reads vectors out of
MJ: Entity Record Documents keyed by EntityDocumentID, so it overrides this to true.
Callers that hold both identifiers (e.g. the duplicate-record detector) consult this to
pass the correct id for the resolved provider instead of assuming index-name semantics.
In-process — it reads entity rows through RunView and calls no external service, so it needs no API key.
Whether this provider stores vectors inside the application's relational database and
can resolve query results to entity records without an external mapping hop. Override
and return true in colocated providers (e.g. PgVectorColocated, SQLServerVectorDatabase).
Whether this provider supports hybrid (vector + keyword) search. Override and return true in providers that implement HybridQuery().
Convert SharedIndexFilterOptions to a provider-native filter object.
Override this method in provider subclasses to produce provider-specific filter syntax (e.g., Pinecone, Weaviate, Qdrant, etc.).
The high-level filter options
A native filter object, or undefined if no filters
Build per-record routing and operational directives for this provider.
Called by the generic sync pipeline once per source database row, before the
VectorRecord is constructed. The returned object is stored on
VectorRecord.providerTemporaryDirectives and passed to CreateRecords alongside
the stored metadata — but is never itself persisted in the vector index.
Providers override this to extract whatever routing values they need from
providerConfig (the parsed VectorIndex.ProviderConfig JSON) and from
sourceRecord (the raw database row). Example: the Pinecone driver reads
providerConfig.namespaceField, looks up the corresponding value in sourceRecord,
and returns { namespace: '<orgId>' } so CreateRecords can route each vector
to the correct Pinecone namespace without embedding org data in the stored metadata.
A provider MAY throw from this method to reject the record — e.g. when its config makes a routing value mandatory (a tenant-isolation field) and the source record cannot supply it. Pipelines treat a throw as a per-record failure: that record is failed/skipped and the rest of the batch proceeds. Providers that never reject simply don't throw.
The default implementation returns an empty object — providers that do not need per-record routing need not override this method.
The raw database row being vectorized, enriched with any paths declared by GetSourceRecordFieldPaths.
The parsed VectorIndex.ProviderConfig JSON blob.
An opaque key/value map consumed by this provider's CreateRecord(s).
Run a colocated query that fuses a vector component with an optional keyword component
in a single server-side statement, applying an optional metadata filter. Only meaningful
when SupportsColocatedQuery is true; the default implementation throws to surface
misuse on providers that don't support it.
Optional_contextUser: UserInfoDelete ALL records from an index. Use with caution.
The name of the index to clear
Declare which source-record field paths this provider's config references.
Pipelines call this before building records so they can resolve the declared paths and
hand BuildProviderDirectives a source record that contains them. A path is either
a plain field name on the source record ('OrganizationID') or a single-hop dotted path
through a foreign key ('ContentSourceID.OrganizationID') — dotted paths are resolved by
the calling pipeline against related records and the resolved value is injected into the
source record under the full path key, so a provider reads it with a plain
sourceRecord[path] lookup either way.
The default implementation declares nothing — providers whose directives only use fields already present on the source record need not override this.
The parsed VectorIndex.ProviderConfig JSON blob.
Field paths the pipeline should resolve onto the source record before calling BuildProviderDirectives. Empty when none are needed.
Perform a hybrid search combining vector similarity with keyword (BM25) matching. Only available on providers where SupportsHybridSearch is true. Default implementation falls back to a standard vector QueryIndex call.
OptionalcontextUser: UserInfoLists no IDs. The vectors are rows of the configured entity, readable only as a calling user (row-level security applies), and this contract carries no user — so there is no honest list to return. Callers that reconcile a remote store against its source skip read-only drivers.
Query the vector index with metadata filtering using SharedIndexFilterOptions.
Default implementation converts the filter options to a native filter object and delegates to QueryIndex. Providers can override BuildMetadataFilter() for custom filter syntax.
Standard query options with an additional metadataFilter field
OptionalcontextUser: UserInfoThe query response from the vector database
Query an index for nearest neighbours.
Query parameters (vector or record id, topK, filter, etc.)
OptionalcontextUser: UserInfoOptional caller identity. Remote drivers (Pinecone,
Qdrant, pgvector) authenticate via their own credentials and ignore
this parameter. In-process drivers that need to honor server-side
row-level security (e.g. SimpleVectorDatabase, which calls RunView
to load entity vectors) require it. Pattern matches MJ's
RunView(params, contextUser) and GetEntityObject(name, contextUser)
conventions.
Wire in the host relational connection so this provider reuses it for colocated storage and queries instead of opening its own pool. No-op semantics for providers that ignore it; colocated providers require it before any operation.
Convenience used by callers that hold an opaque provider reference (the active MJ data
provider). If host implements IColocatedVectorHost and this provider supports
colocated queries, wire it in.
true if the host was wired in, false otherwise.
ProtectedwrapBuild a standard FAILURE BaseResponse.
Always return this (never a success response) from a catch block — returning a
success response on error silently swallows real failures and makes callers, and the
vectorization pipeline, believe an operation worked when it did not.
Optionalmessage: stringOptional human-readable error detail; falls back to a generic message.
ProtectedwrapBuild a standard SUCCESS BaseResponse. Shared across all drivers so every provider reports results in a uniform shape.
The provider-specific payload to attach to the response.
In-process driver — no remote authentication.
VectorDBBase's base constructor rejects empty keys (designed for Pinecone/Qdrant which authenticate via API key), so we substitute a placeholder when the caller didn't provide one. This means deployments don't need to setAI_VENDOR_API_KEY__SIMPLEVECTORDATABASEfor the driver to load.