FilteredDiskANN

Struct FilteredDiskANN 

Source
pub struct FilteredDiskANN<D>
where D: Distance<f32> + Send + Sync + Copy + Clone + 'static,
{ /* private fields */ }
Expand description

DiskANN index with metadata filtering support

Implementations§

Source§

impl<D> FilteredDiskANN<D>
where D: Distance<f32> + Send + Sync + Copy + Clone + Default + 'static,

Source

pub fn build( vectors: &[Vec<f32>], labels: &[Vec<u64>], base_path: &str, ) -> Result<Self, DiskAnnError>

Build a new filtered index

Source

pub fn build_with_params( vectors: &[Vec<f32>], labels: &[Vec<u64>], base_path: &str, params: DiskAnnParams, ) -> Result<Self, DiskAnnError>

Build with custom parameters

Source

pub fn open(base_path: &str) -> Result<Self, DiskAnnError>

Open an existing filtered index

Source§

impl<D> FilteredDiskANN<D>
where D: Distance<f32> + Send + Sync + Copy + Clone + 'static,

Source

pub fn search_filtered( &self, query: &[f32], k: usize, beam_width: usize, filter: &Filter, ) -> Vec<u32>

Search with a filter predicate

Uses an expanded beam search that skips non-matching candidates but continues exploring the graph to find matches.

Source

pub fn search_filtered_with_dists( &self, query: &[f32], k: usize, beam_width: usize, filter: &Filter, ) -> Vec<(u32, f32)>

Search with filter, returning distances

Source

pub fn search_filtered_batch( &self, queries: &[Vec<f32>], k: usize, beam_width: usize, filter: &Filter, ) -> Vec<Vec<u32>>

Parallel batch filtered search

Source

pub fn search(&self, query: &[f32], k: usize, beam_width: usize) -> Vec<u32>

Unfiltered search (delegates to base index)

Source

pub fn get_labels(&self, id: usize) -> Option<&[u64]>

Get labels for a vector

Source

pub fn inner(&self) -> &DiskANN<D>

Get the underlying index

Source

pub fn num_vectors(&self) -> usize

Number of vectors in the index

Source

pub fn num_fields(&self) -> usize

Number of label fields per vector

Source

pub fn count_matching(&self, filter: &Filter) -> usize

Count vectors matching a filter (useful for selectivity estimation)

Auto Trait Implementations§

§

impl<D> Freeze for FilteredDiskANN<D>
where D: Freeze,

§

impl<D> RefUnwindSafe for FilteredDiskANN<D>
where D: RefUnwindSafe,

§

impl<D> Send for FilteredDiskANN<D>

§

impl<D> Sync for FilteredDiskANN<D>

§

impl<D> Unpin for FilteredDiskANN<D>
where D: Unpin,

§

impl<D> UnwindSafe for FilteredDiskANN<D>
where D: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V