#include <IndexShards.h>
Public Types | |
using | idx_t = typename IndexT::idx_t |
using | component_t = typename IndexT::component_t |
using | distance_t = typename IndexT::distance_t |
Public Member Functions | |
IndexShardsTemplate (bool threaded=false, bool successive_ids=true) | |
IndexShardsTemplate (idx_t d, bool threaded=false, bool successive_ids=true) | |
IndexShardsTemplate (int d, bool threaded=false, bool successive_ids=true) | |
void | add_shard (IndexT *index) |
Alias for addIndex() | |
void | remove_shard (IndexT *index) |
Alias for removeIndex() | |
void | add (idx_t n, const component_t *x) override |
supported only for sub-indices that implement add_with_ids | |
void | add_with_ids (idx_t n, const component_t *x, const idx_t *xids) override |
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 | sync_with_shard_indexes () |
![]() | |
ThreadedIndex (bool threaded) | |
ThreadedIndex (int d, bool threaded) | |
void | addIndex (IndexT *index) |
void | removeIndex (IndexT *index) |
void | runOnIndex (std::function< void(int, IndexT *)> f) |
void | runOnIndex (std::function< void(int, const IndexT *)> f) const |
void | reset () override |
int | count () const |
Returns the number of sub-indices. | |
IndexT * | at (int i) |
Returns the i-th sub-index. | |
const IndexT * | at (int i) const |
Returns the i-th sub-index (const version) | |
Public Attributes | |
bool | successive_ids |
![]() | |
bool | own_fields |
Whether or not we are responsible for deleting our contained indices. | |
Protected Member Functions | |
void | onAfterAddIndex (IndexT *index) override |
Called just after an index is added. | |
void | onAfterRemoveIndex (IndexT *index) override |
Called just after an index is removed. | |
Additional Inherited Members | |
![]() | |
static void | waitAndHandleFutures (std::vector< std::future< bool >> &v) |
![]() | |
std::vector< std::pair< IndexT *, std::unique_ptr < WorkerThread > > > | indices_ |
Collection of Index instances, with their managing worker thread if any. | |
bool | isThreaded_ |
Is this index multi-threaded? | |
Index that concatenates the results from several sub-indexes
Definition at line 20 of file IndexShards.h.
|
explicit |
The dimension that all sub-indices must share will be the dimension of the first sub-index added
threaded | do we use one thread per sub_index or do queries sequentially? |
successive_ids | should we shift the returned ids by the size of each sub-index or return them as they are? |
Definition at line 126 of file IndexShards.cpp.
|
explicit |
threaded | do we use one thread per sub_index or do queries sequentially? |
successive_ids | should we shift the returned ids by the size of each sub-index or return them as they are? |
Definition at line 110 of file IndexShards.cpp.
|
explicit |
int version due to the implicit bool conversion ambiguity of int as dimension
Definition at line 118 of file IndexShards.cpp.
|
override |
Cases (successive_ids, xids):
Definition at line 198 of file IndexShards.cpp.