MCPcopy Create free account
hub / github.com/OpenAnonymity/oa-chat / push

Method push

vector/memoryBackend.js:11–27  ·  view source on GitHub ↗
(index, score)

Source from the content-addressed store, hash-verified

9 }
10
11 push(index, score) {
12 if (this.size < this.k) {
13 this.indices[this.size] = index;
14 this.scores[this.size] = score;
15 this.size += 1;
16 this._siftUp(this.size - 1);
17 return;
18 }
19
20 if (score <= this.scores[0]) {
21 return;
22 }
23
24 this.indices[0] = index;
25 this.scores[0] = score;
26 this._siftDown(0);
27 }
28
29 toSortedArray(mapper) {
30 const results = [];

Callers 15

searchMethod · 0.95
loadVectorItemsFunction · 0.80
getMethod · 0.80
searchMethod · 0.80
_prepareItemsMethod · 0.80
_insertDocumentsMethod · 0.80
createOramaStubFunction · 0.80
toSortedArrayMethod · 0.80
prepareItemsMethod · 0.80
getMethod · 0.80
makeVectorsFunction · 0.80
getSessionsPageMethod · 0.80

Calls 2

_siftUpMethod · 0.95
_siftDownMethod · 0.95

Tested by 5

createOramaStubFunction · 0.64
makeVectorsFunction · 0.64
makeZipFunction · 0.64
createAccessHarnessFunction · 0.64
createMockAppFunction · 0.64