pub fn validate_options(
opts: &VectorAnnOptions,
index_shape: IndexShape,
collection_quant: VectorQuantization,
) -> Result<Option<CodecName>, RerankError>Expand description
Validate the option combo against the index shape and the collection’s
configured quantization. Returns the CodecName the search should use
for rerank (None when the request is FP32-only), or
RerankError::BadInput when the combination is invalid.
§Quantization contract
The codec is fixed at collection-creation time. collection_quant is the
quantization that was declared via DDL; opts.quantization is the optional
search-time override.
- If
opts.quantizationisNone: honorcollection_quant— map it to aCodecNameviacodec_name_for_quant. Ternary / OPQ collection configs still surface asBadInputbecause they have no HNSW-integration path. - If
opts.quantizationisSome(q)andq == collection_quant: proceed (same as old behavior — the caller is being explicit about what the index already uses). - If
opts.quantizationisSome(q)andq != collection_quant: returnRerankError::BadInputnaming both the requested codec and the collection’s configured codec. Silent fallback is never allowed. Some(VectorQuantization::None)against any non-Nonecollection_quantis also a contradiction and returnsBadInput.