Milvus as the host's IVectorCollectionStore.
This is the ADAPTER, and the one place allowed to know both sides: the
vector-collection port and the vendor transport in milvus-clj.api. The
port itself is declared by the HOST (hive-mcp.protocols.vector), which
this addon cannot require at compile time — the host jar is provided at
runtime, not a src-scope dependency here. So the protocol is resolved and
extended at FACTORY time via clojure.core/extend, which is a function
and takes the protocol as a runtime value. A standalone compile of this
namespace needs only the vendor jar; a host without the port namespace
fails at the factory call with a reason.
The vendor is late-bound through requiring-resolve for the same reason:
every milvus-clj.api call resolves lazily, and the transport itself must
already be dialed — the hive.milvus addon owns the connection and
milvus-clj keeps it in its singleton; this adapter never dials.
Collection naming: Milvus has no free-form metadata on a collection, so
the embedding dimension is encoded in the name, <name>-<dim>d, the same
convention hive-milvus's memory collections already use
(dim-from-chroma-name). -get-collection recovers the dimension from
the suffix, which is what lets the port's dimension-change detection
survive a JVM restart.
Schema (per collection, generic): id (varchar PK), embedding
(float-vector, dim), document (varchar), metadata (varchar, JSON
string). Metadata is stored as a JSON STRING rather than a JSON column so
the insert path needs no vendor-specific value coercion; :where filters
are therefore applied as a post-filter over fetched rows, sized with an
overfetch factor.
Distances: the collections this adapter creates are indexed HNSW/COSINE,
and Milvus reports COSINE proximity as a SIMILARITY under the :distance
key. The port promises an ASCENDING distance, so 1 - similarity is
applied once, here — the same conversion hive-milvus's search pipeline
performs at its only layer that knows the metric.
Milvus as the host's `IVectorCollectionStore`. This is the ADAPTER, and the one place allowed to know both sides: the vector-collection port and the vendor transport in `milvus-clj.api`. The port itself is declared by the HOST (`hive-mcp.protocols.vector`), which this addon cannot require at compile time — the host jar is provided at runtime, not a src-scope dependency here. So the protocol is resolved and extended at FACTORY time via `clojure.core/extend`, which is a function and takes the protocol as a runtime value. A standalone compile of this namespace needs only the vendor jar; a host without the port namespace fails at the factory call with a reason. The vendor is late-bound through `requiring-resolve` for the same reason: every `milvus-clj.api` call resolves lazily, and the transport itself must already be dialed — the `hive.milvus` addon owns the connection and milvus-clj keeps it in its singleton; this adapter never dials. Collection naming: Milvus has no free-form metadata on a collection, so the embedding dimension is encoded in the name, `<name>-<dim>d`, the same convention hive-milvus's memory collections already use (`dim-from-chroma-name`). `-get-collection` recovers the dimension from the suffix, which is what lets the port's dimension-change detection survive a JVM restart. Schema (per collection, generic): `id` (varchar PK), `embedding` (float-vector, dim), `document` (varchar), `metadata` (varchar, JSON string). Metadata is stored as a JSON STRING rather than a JSON column so the insert path needs no vendor-specific value coercion; `:where` filters are therefore applied as a post-filter over fetched rows, sized with an overfetch factor. Distances: the collections this adapter creates are indexed HNSW/COSINE, and Milvus reports COSINE proximity as a SIMILARITY under the `:distance` key. The port promises an ASCENDING distance, so `1 - similarity` is applied once, here — the same conversion hive-milvus's search pipeline performs at its only layer that knows the metric.
(milvus-vector-store)Create the Milvus-backed IVectorCollectionStore. Resolves the host's
port protocol and extends the record onto it, so a runtime without the
port fails here with a reason. No connection is made here — calls fail
loudly until the hive.milvus addon has dialed.
Create the Milvus-backed `IVectorCollectionStore`. Resolves the host's port protocol and extends the record onto it, so a runtime without the port fails here with a reason. No connection is made here — calls fail loudly until the `hive.milvus` addon has dialed.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |