select_strategy

Function select_strategy 

Source
pub fn select_strategy(selectivity: f32) -> FilterStrategy
Expand description

Select strategy based on estimated selectivity.

Decision matrix:

  • selectivity > 0.8: PreFilter (scan all metadata first)
  • selectivity < 0.05: PostFilter with high oversample
  • Otherwise: Hybrid with adaptive oversample

§Arguments

  • selectivity - Estimated fraction of vectors passing (0.0 to 1.0)

§Returns

The recommended FilterStrategy for the given selectivity.

§Example

use edgevec::filter::strategy::{select_strategy, FilterStrategy};

// High selectivity -> PreFilter
assert_eq!(select_strategy(0.9), FilterStrategy::PreFilter);

// Low selectivity -> PostFilter
assert!(matches!(select_strategy(0.03), FilterStrategy::PostFilter { .. }));

// Medium selectivity -> Hybrid
assert!(matches!(select_strategy(0.3), FilterStrategy::Hybrid { .. }));