#[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-ktruncation when the predicate is selective (you may have to scan far pastkto 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. RequiresMetadataIndexco-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
impl Clone for FilterStrategy
Source§fn clone(&self) -> FilterStrategy
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for FilterStrategy
Source§impl Debug for FilterStrategy
impl Debug for FilterStrategy
impl Eq for FilterStrategy
Source§impl Hash for FilterStrategy
impl Hash for FilterStrategy
Source§impl PartialEq for FilterStrategy
impl PartialEq for FilterStrategy
Source§fn eq(&self, other: &FilterStrategy) -> bool
fn eq(&self, other: &FilterStrategy) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for FilterStrategy
Auto Trait Implementations§
impl Freeze for FilterStrategy
impl RefUnwindSafe for FilterStrategy
impl Send for FilterStrategy
impl Sync for FilterStrategy
impl Unpin for FilterStrategy
impl UnsafeUnpin for FilterStrategy
impl UnwindSafe for FilterStrategy
Blanket Implementations§
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
Mutably borrows from an owned value. Read more