MCPcopy Create free account
hub / github.com/ZenSystemAI/Zengram / vectorDistanceExpr

Function vectorDistanceExpr

api/src/services/pgvector.js:69–74  ·  view source on GitHub ↗
(mode, dims, param = '$1')

Source from the content-addressed store, hash-verified

67// stored column and the query param are cast to halfvec(dims) so the operator
68// matches the halfvec HNSW index.
69export function vectorDistanceExpr(mode, dims, param = '$1') {
70 if (mode === 'halfvec') {
71 return `(vector::halfvec(${dims})) <=> ${param}::halfvec(${dims})`;
72 }
73 return `vector <=> ${param}::vector`;
74}
75
76// Startup dims-guard decision: does the existing vector column's declared
77// dimension conflict with the provider's dims? atttypmod is the declared N for

Callers 2

searchPointsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected