diff --git a/src/hnsw.h b/src/hnsw.h index b7c60c1..bf3ddca 100644 --- a/src/hnsw.h +++ b/src/hnsw.h @@ -475,7 +475,7 @@ void *HnswAlloc(HnswAllocator * allocator, Size size); HnswElement HnswInitElement(char *base, ItemPointer tid, int m, double ml, int maxLevel, HnswAllocator * alloc); HnswElement HnswInitElementFromBlock(BlockNumber blkno, OffsetNumber offno); void HnswFindElementNeighbors(char *base, HnswElement element, HnswElement entryPoint, Relation index, HnswSupport * support, int m, int efConstruction, bool existing); -HnswSearchCandidate *HnswEntryCandidate(char *base, HnswElement entryPoint, HnswQuery * q, Relation index, HnswSupport * support, bool loadVec); +HnswSearchCandidate *HnswEntryCandidate(char *base, HnswElement entryPoint, HnswSearchState * searchState, Relation index, HnswSupport * support, bool loadVec); void HnswUpdateMetaPage(Relation index, int updateEntry, HnswElement entryPoint, BlockNumber insertPage, ForkNumber forkNum, bool building); void HnswSetNeighborTuple(char *base, HnswNeighborTuple ntup, HnswElement e, int m); void HnswAddHeapTid(HnswElement element, ItemPointer heaptid); diff --git a/src/hnswscan.c b/src/hnswscan.c index db00b46..5a8d459 100644 --- a/src/hnswscan.c +++ b/src/hnswscan.c @@ -49,7 +49,7 @@ GetScanItems(IndexScanDesc scan, Datum value) if (entryPoint == NULL) return NIL; - ep = list_make1(HnswEntryCandidate(base, entryPoint, &searchState->q, index, support, false)); + ep = list_make1(HnswEntryCandidate(base, entryPoint, searchState, index, support, false)); for (int lc = entryPoint->level; lc >= 1; lc--) { diff --git a/src/hnswutils.c b/src/hnswutils.c index c290f74..7446d8e 100644 --- a/src/hnswutils.c +++ b/src/hnswutils.c @@ -612,15 +612,15 @@ HnswInitSearchCandidate(char *base, HnswElement element, double distance) * Create a candidate for the entry point */ HnswSearchCandidate * -HnswEntryCandidate(char *base, HnswElement entryPoint, HnswQuery * q, Relation index, HnswSupport * support, bool loadVec) +HnswEntryCandidate(char *base, HnswElement entryPoint, HnswSearchState * searchState, Relation index, HnswSupport * support, bool loadVec) { bool inMemory = index == NULL; double distance; if (inMemory) - distance = GetElementDistance(base, entryPoint, q, support); + distance = GetElementDistance(base, entryPoint, &searchState->q, support); else - HnswLoadElement(entryPoint, &distance, q, index, support, loadVec, NULL); + HnswLoadElement(entryPoint, &distance, &searchState->q, index, support, loadVec, NULL); return HnswInitSearchCandidate(base, entryPoint, distance); } @@ -1302,7 +1302,7 @@ HnswFindElementNeighbors(char *base, HnswElement element, HnswElement entryPoint return; /* Get entry point and level */ - ep = list_make1(HnswEntryCandidate(base, entryPoint, &searchState.q, index, support, true)); + ep = list_make1(HnswEntryCandidate(base, entryPoint, &searchState, index, support, true)); entryLevel = entryPoint->level; /* 1st phase: greedy search to insert level */