8000 Removed lc from SelectNeighbors [skip ci] · postgrespro/pgvector@f371eb1 · GitHub
[go: up one dir, main page]

Skip to content

Commit f371eb1

Browse files
committed
Removed lc from SelectNeighbors [skip ci]
1 parent 382a25a commit f371eb1

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/hnswutils.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -959,14 +959,13 @@ CheckElementCloser(char *base, HnswCandidate * e, List *r, FmgrInfo *procinfo, O
959959
* Algorithm 4 from paper
960960
*/
961961
static List *
962-
SelectNeighbors(char *base, List *c, int lm, int lc, FmgrInfo *procinfo, Oid collation, HnswElement e2, HnswCandidate * newCandidate, HnswCandidate * *pruned, bool sortCandidates)
962+
SelectNeighbors(char *base, List *c, int lm, FmgrInfo *procinfo, Oid collation, HnswNeighborArray * neighbors, HnswCandidate * newCandidate, HnswCandidate * *pruned, bool sortCandidates)
963963
{
964964
List *r = NIL;
965965
List *w = list_copy(c);
966966
HnswCandidate **wd;
967967
int wdlen = 0;
968968
int wdoff = 0;
969-
HnswNeighborArray *neighbors = HnswGetNeighbors(base, e2, lc);
970969
bool mustCalculate = !neighbors->closerSet;
971970
List *added = NIL;
972971
bool removedAny = false;
@@ -1139,7 +1138,7 @@ HnswUpdateConnection(char *base, HnswElement element, HnswCandidate * hc, int lm
11391138
c = lappend(c, &currentNeighbors->items[i]);
11401139
c = lappend(c, &hc2);
11411140

1142-
SelectNeighbors(base, c, lm, lc, procinfo, collation, hce, &hc2, &pruned, true);
1141+
SelectNeighbors(base, c, lm, procinfo, collation, currentNeighbors, &hc2, &pruned, true);
11431142

11441143
/* Should not happen */
11451144
if (pruned == NULL)
@@ -1278,7 +1277,7 @@ HnswFindElementNeighbors(char *base, HnswElement element, HnswElement entryPoint
12781277
* sortCandidates to true for in-memory builds to enable closer
12791278
* caching, but there does not seem to be a difference in performance.
12801279
*/
1281-
neighbors = SelectNeighbors(base, lw, lm, lc, procinfo, collation, element, NULL, NULL, false);
1280+
neighbors = SelectNeighbors(base, lw, lm, procinfo, collation, HnswGetNeighbors(base, element, lc), NULL, NULL, false);
12821281

12831282
AddConnections(base, element, neighbors, lc);
12841283

0 commit comments

Comments
 (0)
0