Skip to main content

FilterStrategy

Enum FilterStrategy 

Source
#[non_exhaustive]
pub enum FilterStrategy { PreFilter, PostFilter, InFilter, Auto, }
Expand description

How an index plans to apply a metadata Filter relative to its distance scan.

#[non_exhaustive] because selection logic will add variants (and likely adapter parameters) as approximate indexes start honouring filters. Callers should not exhaustively match on this enum and should not rely on the variant set being closed.

§Variants in plain terms

  • FilterStrategy::PreFilter — apply the predicate before the distance computation; only matching candidates enter the scan. Cheap when the predicate is selective, wasteful when it is broad.
  • FilterStrategy::PostFilter — run the distance scan over every candidate, then drop hits that fail the predicate. Cheap when the predicate is broad, defeats top-k truncation when the predicate is selective (you may have to scan far past k to refill the result set).
  • FilterStrategy::InFilter — interleave predicate evaluation with the distance walk so a graph index can prune branches it knows can’t produce surviving candidates. Requires MetadataIndex co-design.
  • FilterStrategy::Auto — let the index pick from the above based on estimated selectivity. Requires the selectivity machinery that doesn’t exist yet; documented here so future configs can name it.

§Examples

use iqdb_filter::FilterStrategy;

let chosen = FilterStrategy::PreFilter;
// Callers do not branch on this yet; the enum is vocabulary for later.
assert_ne!(chosen, FilterStrategy::PostFilter);

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

PreFilter

Apply the predicate before the distance scan.

§

PostFilter

Apply the predicate after the distance scan.

§

InFilter

Interleave the predicate with a graph traversal.

§

Auto

Let the index pick the strategy based on estimated selectivity.

Trait Implementations§

Source§

impl Clone for FilterStrategy

Source§

fn clone(&self) -> FilterStrategy

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for FilterStrategy

Source§

impl Debug for FilterStrategy

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for FilterStrategy

Source§

impl Hash for FilterStrategy

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for FilterStrategy

Source§

fn eq(&self, other: &FilterStrategy) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for FilterStrategy

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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<E> WithErrorCode<E> for E

Source§

fn with_code(self, code: impl Into<String>) -> CodedError<E>

Attach an error code to an error