docs(vector): add local backup restore and parity gate

This commit is contained in:
2026-07-12 02:18:29 +02:00
parent 1145ae20bc
commit e4db2ea5e1
8 changed files with 471 additions and 5 deletions
+2 -2
View File
@@ -257,7 +257,7 @@ class PgVectorStore:
where = sql.SQL(" WHERE kind = ANY(%s)") if collection_kinds else sql.SQL("")
query = sql.SQL(
"SELECT metadata, 1 - (embedding {} %s::{}) AS similarity "
"FROM {}{} ORDER BY embedding {} %s::{} LIMIT %s"
"FROM {}{} ORDER BY embedding {} %s::{}, record_key LIMIT %s"
).format(
_cosine_operator(self._schema),
_vector_type(self._schema),
@@ -274,7 +274,7 @@ class PgVectorStore:
hits.extend(hit_from_metadata(row[1], row[0]) for row in cursor.fetchall())
finally:
raw.close()
return sorted(hits, key=lambda hit: hit.similarity, reverse=True)[:limit]
return sorted(hits, key=lambda hit: (-hit.similarity, hit.id))[:limit]
def _require_writer(self) -> Engine:
if self._writer is None: