facebookresearch / faiss

A library for efficient similarity search and clustering of dense vectors.
https://faiss.ai
MIT License
31.7k stars 3.66k forks source link

Index factory with index string including IDMap and refinement produces an index that can't add vectors #3893

Closed gtwang01 closed 1 month ago

gtwang01 commented 2 months ago

Summary

As title suggests, index strings like "IDMap,PQx4fs,RFlat" produces an index that cannot add vectors. This is because the refinement index is the outermost wrapper, which doesn't support add_with_ids. However, IDMap is an internal wrapper, which doesn't support the regular add. The resulting index is unable to add vectors by either means. This should be easy to resolve by just moving the IDMap resolution in the index factory to the very top, making it the outermost wrapper all of the time.

Platform

OS:

Faiss version: most recent

Installed from: irrelevant

Faiss compilation options: irrelevant

Running on: irrelevant

Interface:

Reproduction instructions

Get index with "IDMap,PQx4fs,RFlat" and try to add a vector with add or add_with_ids.