mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-09 14:20:57 +08:00
Added support function for l2_normalize [skip ci]
This commit is contained in:
@@ -195,17 +195,12 @@ HnswGetType(Relation index)
|
||||
* Normalize value
|
||||
*/
|
||||
Datum
|
||||
HnswNormValue(Datum value, HnswType type)
|
||||
HnswNormValue(FmgrInfo *procinfo, Oid collation, Datum value)
|
||||
{
|
||||
/* TODO Remove type-specific code */
|
||||
if (type == HNSW_TYPE_VECTOR)
|
||||
if (procinfo == NULL)
|
||||
return DirectFunctionCall1(l2_normalize, value);
|
||||
else if (type == HNSW_TYPE_HALFVEC)
|
||||
return DirectFunctionCall1(halfvec_l2_normalize, value);
|
||||
else if (type == HNSW_TYPE_SPARSEVEC)
|
||||
return DirectFunctionCall1(sparsevec_l2_normalize, value);
|
||||
else
|
||||
elog(ERROR, "Unsupported type");
|
||||
|
||||
return FunctionCall1Coll(procinfo, collation, value);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user