Skip to content

Commit d29e0ef

Browse files
Remove unnecessary function redirect within faiss_vector_cache.go (#333)
Remove unnecessary assignments and cleanup.
1 parent 1aa1a6e commit d29e0ef

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

faiss_vector_cache.go

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,26 +52,14 @@ func (vc *vectorIndexCache) Clear() {
5252
vc.m.Unlock()
5353
}
5454

55-
// loadDocVecIDMap indicates if a non-nil docVecIDMap should be returned.
56-
// It is true when a filtered kNN query accesses the cache since it requires the
57-
// map. It's false otherwise.
55+
// loadOrCreate obtains the vector index from the cache or creates it if it's not
56+
// present. It also returns the batch executor for the field if it's present in the
57+
// cache.
5858
func (vc *vectorIndexCache) loadOrCreate(fieldID uint16, mem []byte,
5959
loadDocVecIDMap bool, except *roaring.Bitmap) (
6060
index *faiss.IndexImpl, vecDocIDMap map[int64]uint32, docVecIDMap map[uint32][]int64,
6161
vecIDsToExclude []int64, err error) {
62-
index, vecDocIDMap, docVecIDMap, vecIDsToExclude, err = vc.loadFromCache(
63-
fieldID, loadDocVecIDMap, mem, except)
64-
return index, vecDocIDMap, docVecIDMap, vecIDsToExclude, err
65-
}
66-
67-
// function to load the vectorDocIDMap and if required, docVecIDMap from cache
68-
// If not, it will create these and add them to the cache.
69-
func (vc *vectorIndexCache) loadFromCache(fieldID uint16, loadDocVecIDMap bool,
70-
mem []byte, except *roaring.Bitmap) (index *faiss.IndexImpl, vecDocIDMap map[int64]uint32,
71-
docVecIDMap map[uint32][]int64, vecIDsToExclude []int64, err error) {
72-
7362
vc.m.RLock()
74-
7563
entry, ok := vc.cache[fieldID]
7664
if ok {
7765
index, vecDocIDMap, docVecIDMap = entry.load()

0 commit comments

Comments
 (0)