Enet4/faiss-rs

Dynamically casting the wrapped quantizer when casting a IndexImpl to a IVFScalarQuantizerIndex?

Offen

#100 geöffnet am 04.09.2025

 (3 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Rust (50 Forks)auto 404
enhancementhelp wanted

Repository-Metriken

Stars
 (252 Sterne)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

So I'm trying to read an IVFScalarQuantizer index from a file but it seems like IndexImpl::into_ivf_scalar_quantizer allows me to build a IVFScalarQuantizerIndex<IndexImpl>, but then there is no way to downcast the wrapped quantizer into a concrete type like FlatIndex (to get the ConcurrentIndex impl for it).

Thoughts on letting the quantizer also be specified during the conversion?

- pub fn into_ivf_scalar_quantizer(self) -> Result<IVFScalarQuantizerIndexImpl<IndexImpl>>
+ pub fn into_ivf_scalar_quantizer<Q>(self) -> Result<IVFScalarQuantizerIndexImpl<Q>>

This would allow the caller to assume a concrete type for the quantizer, which would then enable other traits like ConcurrentIndex (if the quantizer index is itself a ConcurrentIndex).

Contributor Guide