SimpleVectorIndex.load() is easy to be called more than once
FlyingDuck opened this issue · 2 comments
FlyingDuck commented
func (s *Index) IsEmpty() (bool, error) {
...
err := s.load()
...
}
func (s *Index) SimilaritySearch(ctx context.Context, query string, opts ...option.Option) (index.SearchResponses, error) {
...
err := s.load()
...
}
The invocation of the load()
function is very subtle, which easily leads to cases of repeated calls. Such as in the example.
We'd better make sure it's loaded only once.