From: Ksschkw (@Ksschkw) <noreply+Ksschkw@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] PR #1056: Fixed Jaccard distance for two empty bit vectors
Date: Tue, 03 Nov 2026 17:34:26 +0000
Message-ID: <gh-pgvector-pgvector-1056-c6611044117@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-1056@github.com>
References: <gh-pgvector-pgvector-1056@github.com>
Answering the question you asked on the issue — the practical case, briefly.
An all-zero bit vector is what you get when the source yields no bits: empty
or stopword-only text, or an empty tag/feature set. Under distance `1`, such a
row is tied at *maximal* distance with every other row, including itself. Two
consequences:
1. It cannot be distinguished as its own nearest neighbour, so an index/search
round trip fails for exactly the rows that carry no signal. `<~>` on the same
pair returns 0, so the two operators disagree about the same input.
2. Identical empty documents cannot be deduplicated by Jaccard similarity, so a
"find duplicates" query silently misses them.
Nearest-neighbour search over bit vectors is usually about tag or feature
overlap, where empty rows are ordinary rather than exceptional.
That said, your point stands that scikit-learn and RDKit return 1, and the
distance is genuinely undefined for two empty sets. If you would rather keep 1
as the documented behaviour, I am happy to close this and open a documentation
change instead — either way the choice should be stated, not discovered.
Your call; no urgency from my side.