diff --git a/src/hnswutils.c b/src/hnswutils.c index 8e6f2a9..76051b2 100644 --- a/src/hnswutils.c +++ b/src/hnswutils.c @@ -645,11 +645,10 @@ HnswSearchLayer(Datum q, List *ep, int ef, int lc, Relation index, FmgrInfo *pro */ if (skipElement == NULL || list_length(e->element->heaptids) != 0) { - wlen++; - - /* No need to decrement wlen */ - if (wlen > ef) + if (wlen >= ef) pairingheap_remove_first(W); + else + wlen++; } } }