Struct faiss::IndexIDMap2Template

template<typename IndexT>
struct IndexIDMap2Template : public faiss::IndexIDMapTemplate<IndexT>

same as IndexIDMap but also provides an efficient reconstruction implementation via a 2-way index

Public Types

using component_t = typename IndexT::component_t
using distance_t = typename IndexT::distance_t

Public Functions

explicit IndexIDMap2Template(IndexT *index)
void construct_rev_map()

make the rev_map from scratch

void add_with_ids(idx_t n, const component_t *x, const idx_t *xids) override
size_t remove_ids(const IDSelector &sel) override
void reconstruct(idx_t key, component_t *recons) const override
void check_consistency() const

check that the rev_map and the id_map are in sync

void merge_from(IndexT &otherIndex, idx_t add_id = 0) override
inline ~IndexIDMap2Template() override
inline IndexIDMap2Template()
void add(idx_t n, const component_t *x) override

this will fail. Use add_with_ids

void search(idx_t n, const component_t *x, idx_t k, distance_t *distances, idx_t *labels, const SearchParameters *params = nullptr) const override
void train(idx_t n, const component_t *x) override
void reset() override
void range_search(idx_t n, const component_t *x, distance_t radius, RangeSearchResult *result, const SearchParameters *params = nullptr) const override
void check_compatible_for_merge(const IndexT &otherIndex) const override
size_t sa_code_size() const override
void add_sa_codes(idx_t n, const uint8_t *x, const idx_t *xids) override

Public Members

std::unordered_map<idx_t, idx_t> rev_map
IndexT *index = nullptr
bool own_fields = false

! the sub-index

std::vector<idx_t> id_map

! whether pointers are deleted in destructo