mirror of
https://github.com/pgvector/pgvector.git
synced 2026-10-23 10:48:54 +03:00
Updated HnswEntryCandidate [skip ci]
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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--)
|
||||
{
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user