Index


Description:

public Index (string filename, int dim) throws Error

Constructor.

Creates a new index or loads an existing one from disk. If the index file exists, it will be loaded (dimension comes from the file). If the file doesn't exist, a new HNSW index will be created with the specified dimension.

Parameters:

filename

Path to the FAISS index file

dim

The dimension of vectors (must match if loading existing index)

Exceptions:

Error

if index file exists but dimension doesn't match, or if index creation/loading fails