pub struct SieveCollection { /* private fields */ }Expand description
A collection of specialized HNSW subindices, one per stable predicate.
Each subindex is built over the subset of vectors that match its predicate.
Smaller datasets mean a lower sub_m is sufficient, keeping memory overhead
proportional to the per-predicate population rather than the global index.
Implementations§
Source§impl SieveCollection
impl SieveCollection
Sourcepub fn new(sub_m: usize) -> Self
pub fn new(sub_m: usize) -> Self
Create an empty collection. sub_m is the HNSW M parameter used for
every subindex built by this collection.
Sourcepub fn build_subindex(
&mut self,
signature: PredicateSignature,
vectors: &[(u32, Vec<f32>)],
dim: usize,
metric: DistanceMetric,
) -> Result<(), VectorError>
pub fn build_subindex( &mut self, signature: PredicateSignature, vectors: &[(u32, Vec<f32>)], dim: usize, metric: DistanceMetric, ) -> Result<(), VectorError>
Build (or rebuild) a specialized subindex for signature from the
provided (id, vector) pairs.
All vectors must have length dim. The subindex uses metric for
distance computation.
§Errors
Returns VectorError if any insertion fails (e.g. dimension mismatch).
Sourcepub fn has(&self, signature: &PredicateSignature) -> bool
pub fn has(&self, signature: &PredicateSignature) -> bool
Returns true if a subindex exists for the given signature.
Sourcepub fn get(&self, signature: &PredicateSignature) -> Option<&HnswIndex>
pub fn get(&self, signature: &PredicateSignature) -> Option<&HnswIndex>
Returns a shared reference to the subindex for signature, or None.
Sourcepub fn drop(&mut self, signature: &PredicateSignature)
pub fn drop(&mut self, signature: &PredicateSignature)
Remove the subindex for signature, freeing its memory.
Sourcepub fn signatures(&self) -> Vec<&PredicateSignature> ⓘ
pub fn signatures(&self) -> Vec<&PredicateSignature> ⓘ
All predicate signatures currently held in this collection.
Auto Trait Implementations§
impl Freeze for SieveCollection
impl !RefUnwindSafe for SieveCollection
impl Send for SieveCollection
impl !Sync for SieveCollection
impl Unpin for SieveCollection
impl UnsafeUnpin for SieveCollection
impl UnwindSafe for SieveCollection
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.