Skip to main content

is_trained

bool is_trained() const;
Returns whether the index has been trained. Returns true only when the training state is Trained. While a (re)train rebuild is in progress this returns false, and queries transparently fall back to the untrained (exhaustive) search path. See is_training and training_state.

is_training

bool is_training() const;
Returns true while a (re)train rebuild is in progress, otherwise false.

training_state

TrainingState training_state() const;
Returns the current training state as a TrainingState enum: Untrained, Training, or Trained.

index_name

std::string index_name() const;
Returns the name of the index.

index_type

IndexType index_type() const;
Returns the type of the index as an IndexType enum. The only value is DISK_IVF.

index_config

IndexDiskIVF* index_config() const;
Returns a pointer to the index configuration (IndexDiskIVF).

ListIDs

std::vector<std::string> ListIDs(const KeyContext& key);
Returns a vector containing all item IDs currently stored in the index.

Parameters

ParameterTypeDescription
keyKeyContextKey context for the operation. A bare 32-byte index key (the index_key) implicitly converts to a KeyContext.

Exceptions

  • std::runtime_error: Thrown if an error occurs during retrieval.

NumVectors

size_t NumVectors(const KeyContext& key);
Returns the total number of vectors currently stored in the encrypted index.

Parameters

ParameterTypeDescription
keyKeyContextKey context for the operation. A bare 32-byte index key (the index_key) implicitly converts to a KeyContext.

Returns

size_t: The number of vectors in the index.

Exceptions

  • Throws if the index was not created or loaded yet.
  • Throws if an error occurs while retrieving the count.

Example Usage

// Get the number of vectors in the index
size_t vector_count = index->NumVectors(index_key);
std::cout << "Index contains " << vector_count << " vectors" << std::endl;

// Use count for validation or progress reporting
if (vector_count == 0) {
    std::cout << "Index is empty, consider adding vectors" << std::endl;
}
index_key is the 32-byte std::array<uint8_t, 32> index KEK and converts implicitly to a KeyContext.