Struct faiss::IndexIDMapTemplate

template<typename IndexT>
struct IndexIDMapTemplate : public IndexT

Index that translates search results to ids

Subclassed by faiss::IndexIDMap2Template< IndexT >

Public Types

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

Public Functions

explicit IndexIDMapTemplate(IndexT *index)
void add_with_ids(idx_t n, const component_t *x, const idx_t *xids) override
Parameters:

xids – if non-null, ids to store for the vectors (size n)

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
size_t remove_ids(const IDSelector &sel) override

remove ids adapted to IndexFlat

void range_search(idx_t n, const component_t *x, distance_t radius, RangeSearchResult *result, const SearchParameters *params = nullptr) const override
void merge_from(IndexT &otherIndex, idx_t add_id = 0) override
void check_compatible_for_merge(const IndexT &otherIndex) const override
~IndexIDMapTemplate() override
inline IndexIDMapTemplate()

Public Members

IndexT *index = nullptr
bool own_fields = false

! the sub-index

std::vector<idx_t> id_map

! whether pointers are deleted in destructo