mod model;
mod score;
mod search;
mod sections;
#[cfg(test)]
mod tests;
pub use model::{ChunkMapKey, ModelId, ModelIdentity, TextDigest};
pub use score::{dot_product, rank_order, score, vector_norm};
pub use search::{
Coverage, FileMembers, FullScan, Hit, MappedChunk, Member, MemberSet, ScoreBounds,
SearchReport, SearchRequest, SearchResult, SharedVectorIndex, UnitRef, VectorIndex,
default_rescore_limit,
};
pub use sections::{
Chunk, ChunkDetail, FileDetails, KNOWN, MAX_DIMENSIONS, SectionBytes, VectorSectionsBuilder,
VectorSegment, VectorSegmentParts,
};
use crate::segment::SegmentError;
#[derive(Debug, thiserror::Error)]
pub enum VectorError {
#[error(transparent)]
Segment(#[from] SegmentError),
#[error("no vectors are stored for model {0}")]
NoVectors(ModelId),
#[error("the model has {expected} dimensions; the vector has {found}")]
DimensionMismatch { expected: u32, found: usize },
#[error("a model with {0} dimensions is not supported")]
UnsupportedDimensions(u32),
#[error("a vector has a component that is not finite, or a norm that overflows")]
NonFinite,
#[error("a member names vector {} of segment {}, which the index does not have", .0.ordinal, .0.segment)]
UnknownUnit(UnitRef),
#[error("the member set was prepared for another vector index")]
ForeignMembers,
#[error("more members than a search can rank")]
TooManyMembers,
#[error("more segments than an index can hold")]
TooManySegments,
#[error("chunk details do not describe the chunk map's chunks")]
DetailsMismatch,
}