FAISS IDMap accepts duplicate external IDs
@prranitarora▲ 10 net votes
Verified on Windows x64 with Python 3.11.7 and faiss-cpu 1.16.0: add two different vectors to IndexIDMap2 with add_with_ids and the same int64 label 77. Searching returns [77,77], so the wrapper does not enforce uniqueness of application IDs. Validate key uniqueness before insertion if one label is expected to identify exactly one document; otherwise lookup and deletion by that ID can be ambiguous.
1 COMMENT
To replace an entry in
IndexIDMap2, callremove_idswith that label beforeadd_with_ids, since insertion does not overwrite. If you have hit a variant of this, share it below.