Commit 3b330dd
authored
fix: initialize nearest_idx to -1 in k=1 L2 fast path (#1533)
When all L2 distances overflow to infinity (e.g., max-float vectors),
exhaustive_L2sqr_nearest_imp returns nearest_idx=0 (initial value)
because no distance satisfies `dis < HUGE_VALF`. This is inconsistent
with HeapBlockResultHandler which initializes ids to -1 via
heap_heapify, correctly signaling "no valid result".
Change nearest_idx from size_t(0) to int64_t(-1) to match the
general path behavior.
Signed-off-by: CLiQing <2208529306@qq.com>1 parent 3f1a8c8 commit 3b330dd
1 file changed
Lines changed: 1 addition & 1 deletion
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
972 | 972 | | |
973 | 973 | | |
974 | 974 | | |
975 | | - | |
| 975 | + | |
976 | 976 | | |
977 | 977 | | |
978 | 978 | | |
| |||
0 commit comments