From: ankane (@ankane) <noreply+ankane@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #1043: bit Jaccard distance returns 1.0 for identical all-zero bit vectors
Date: Tue, 20 Oct 2026 09:00:03 +0000
Message-ID: <gh-pgvector-pgvector-1043-c6287353639@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-1043@github.com>
References: <gh-pgvector-pgvector-1043@github.com>
To expand on this, since the distance is undefined, the three main options are:
- NaN, which makes zero vectors furthest away from each other (since Postgres treats NaN values as greater than non-NaN values)
- 1, which makes zero vectors the same distance as they are to non-zero vectors
- 0, which makes zero vectors closest
It looks like SciPy switched from NaN to 0 in 2018 to make it a metric (https://github.com/scipy/scipy/pull/7373).
Will think about this a bit more. In the meantime, it'd be good to hear if there are practical applications that benefit from a specific option.