mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-11 07:06:57 +08:00
Use normalize_l2 for normalization
This commit is contained in:
@@ -55,9 +55,20 @@ HnswOptionalProcInfo(Relation rel, uint16 procnum)
|
||||
* if it's different than the original value
|
||||
*/
|
||||
bool
|
||||
HnswNormValue(FmgrInfo *procinfo, Oid collation, Datum *value, Vector * result)
|
||||
HnswNormValue(FmgrInfo *procinfo, FmgrInfo *normalizeprocinfo, Oid collation, Datum *value, Vector * result)
|
||||
{
|
||||
double norm = DatumGetFloat8(FunctionCall1Coll(procinfo, collation, *value));
|
||||
double norm;
|
||||
|
||||
if (normalizeprocinfo != NULL)
|
||||
{
|
||||
*value = FunctionCall1Coll(normalizeprocinfo, collation, *value);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (procinfo == NULL)
|
||||
return true;
|
||||
|
||||
norm = DatumGetFloat8(FunctionCall1Coll(procinfo, collation, *value));
|
||||
|
||||
if (norm > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user