diff --git a/src/hnswutils.c b/src/hnswutils.c index f69c057..6e01cf4 100644 --- a/src/hnswutils.c +++ b/src/hnswutils.c @@ -874,9 +874,6 @@ HnswSearchLayer(char *base, Datum q, List *ep, int ef, int lc, Relation index, F { eElement = unvisited[i].element; eDistance = GetElementDistance(base, eElement, q, procinfo, collation); - - if (!(eDistance < f->distance || alwaysAdd)) - continue; } else { @@ -892,6 +889,9 @@ HnswSearchLayer(char *base, Datum q, List *ep, int ef, int lc, Relation index, F continue; } + if (!(eDistance < f->distance || alwaysAdd)) + continue; + Assert(!eElement->deleted); /* Make robust to issues */