Skip to content

Commit

Permalink
add all wrapped indexes to the index_read
Browse files Browse the repository at this point in the history
Summary:
These were not added in the refactoring, so adding them now.

Added unit tests which should cover things

The `orig->own_fields = false` because we wrap the inner index too, so it gets deleted.

Reviewed By: bshethmeta, pankajsingh88

Differential Revision: D64702824

fbshipit-source-id: b2e36374dd0066581c57a55b0ea16323cdc519f0
  • Loading branch information
Michael Norris authored and facebook-github-bot committed Oct 24, 2024
1 parent 1e7ef59 commit efa18da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions faiss/cppcontrib/factory_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ std::string reverse_index_factory(const faiss::Index* index) {
const faiss::IndexScalarQuantizer* sq_index =
dynamic_cast<const faiss::IndexScalarQuantizer*>(index)) {
return std::string("SQ") + sq_types.at(sq_index->sq.qtype);
} else if (
const faiss::IndexIDMap* idmap =
dynamic_cast<const faiss::IndexIDMap*>(index)) {
return std::string("IDMap,") + reverse_index_factory(idmap->index);
}
// Avoid runtime error, just return empty string for logging.
return "";
Expand Down
1 change: 1 addition & 0 deletions faiss/cppcontrib/factory_tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#pragma once

#include <faiss/IndexHNSW.h>
#include <faiss/IndexIDMap.h>
#include <faiss/IndexIVFFlat.h>
#include <faiss/IndexIVFPQFastScan.h>
#include <faiss/IndexLSH.h>
Expand Down

0 comments on commit efa18da

Please sign in to comment.