Struct faiss::IndexIDMapTemplate

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

Index that translates search results to ids

Subclassed by faiss::IndexIDMap2Template< IndexT >

Public Types

using idx_t = typename IndexT::idx_t
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 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 override
~IndexIDMapTemplate() override
inline IndexIDMapTemplate()

Public Members

IndexT *index
bool own_fields

! the sub-index

std::vector<idx_t> id_map

! whether pointers are deleted in destructo