Make the VectorStore aware of the index version

This commit is contained in:
Clément Renault
2025-08-12 15:09:26 +02:00
committed by Louis Dureuil
parent e4b28464fd
commit e64852208c
11 changed files with 89 additions and 22 deletions

View File

@ -1769,10 +1769,12 @@ impl Index {
) -> Result<BTreeMap<String, EmbeddingsWithMetadata>> {
let mut res = BTreeMap::new();
let embedders = self.embedding_configs();
let index_version = self.get_version(rtxn)?.unwrap();
for config in embedders.embedding_configs(rtxn)? {
let embedder_info = embedders.embedder_info(rtxn, &config.name)?.unwrap();
let has_fragments = config.config.embedder_options.has_fragments();
let reader = VectorStore::new(
index_version,
self.vector_store,
embedder_info.embedder_id,
config.config.quantized(),
@ -1795,10 +1797,15 @@ impl Index {
pub fn hannoy_stats(&self, rtxn: &RoTxn<'_>) -> Result<HannoyStats> {
let mut stats = HannoyStats::default();
let embedding_configs = self.embedding_configs();
let index_version = self.get_version(rtxn)?.unwrap();
for config in embedding_configs.embedding_configs(rtxn)? {
let embedder_id = embedding_configs.embedder_id(rtxn, &config.name)?.unwrap();
let reader =
VectorStore::new(self.vector_store, embedder_id, config.config.quantized());
let reader = VectorStore::new(
index_version,
self.vector_store,
embedder_id,
config.config.quantized(),
);
reader.aggregate_stats(rtxn, &mut stats)?;
}
Ok(stats)