Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions c_api/IndexShards_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ int faiss_IndexShards_remove_shard(FaissIndexShards* index, FaissIndex* shard) {
CATCH_AND_HANDLE
}

int faiss_IndexShards_count(const FaissIndexShards* index) {
return reinterpret_cast<const IndexShards*>(index)->count();
}

FaissIndex* faiss_IndexShards_at(FaissIndexShards* index, int i) {
auto shard = reinterpret_cast<IndexShards*>(index)->at(i);
return reinterpret_cast<FaissIndex*>(shard);
Expand Down
3 changes: 3 additions & 0 deletions c_api/IndexShards_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ int faiss_IndexShards_add_shard(FaissIndexShards* index, FaissIndex* shard);

int faiss_IndexShards_remove_shard(FaissIndexShards* index, FaissIndex* shard);

/// Returns the number of sub-indices (shards)
int faiss_IndexShards_count(const FaissIndexShards* index);

FaissIndex* faiss_IndexShards_at(FaissIndexShards* index, int i);

#ifdef __cplusplus
Expand Down
Loading