pub struct QueryPlanner {
pub config: CollectionConfig,
}Fields§
§config: CollectionConfigImplementations§
Source§impl QueryPlanner
impl QueryPlanner
pub fn new(config: CollectionConfig) -> Self
Sourcepub fn should_use_hnsw(&self, vector_count: usize) -> bool
pub fn should_use_hnsw(&self, vector_count: usize) -> bool
Returns true if the collection is large enough for HNSW to be
faster than brute force (matches HnswIndex auto-build threshold).
Sourcepub fn should_pre_filter(
&self,
estimated_selectivity: f32,
vector_count: usize,
) -> bool
pub fn should_pre_filter( &self, estimated_selectivity: f32, vector_count: usize, ) -> bool
Returns true when pre-filtering (metadata first, then vector scan)
is beneficial.
- Selectivity < 0.1: filter is highly selective → pre-filter saves work.
- Collection > 100 000 vectors: large collections always benefit.
Sourcepub fn compute_candidate_k(
&self,
output_k: usize,
use_hybrid: bool,
has_filter: bool,
) -> usize
pub fn compute_candidate_k( &self, output_k: usize, use_hybrid: bool, has_filter: bool, ) -> usize
Compute the number of dense candidates to fetch.
Multipliers:
- hybrid + filter → ×10 (capped)
- hybrid only → ×5
- filter only → ×3
- neither → ×1
Always at least output_k, at most 10 000.
Sourcepub fn plan_search(
&self,
request: &SearchRequest,
vector_count: usize,
) -> Result<PhysicalPlan>
pub fn plan_search( &self, request: &SearchRequest, vector_count: usize, ) -> Result<PhysicalPlan>
Build a physical plan for a vector / text search request.
Sourcepub fn plan_sql(&self, sql: &str, vector_count: usize) -> Result<PhysicalPlan>
pub fn plan_sql(&self, sql: &str, vector_count: usize) -> Result<PhysicalPlan>
Build a physical plan from a SQL string.
The SQL must contain a VECTOR_SIM(col, [...]) op threshold condition.
An optional scalar equality filter (AND field = value) is translated
into the plan’s filter_predicate.
Sourcepub fn explain(&self, plan: &PhysicalPlan) -> String
pub fn explain(&self, plan: &PhysicalPlan) -> String
Return a human-readable description of the physical plan.
Auto Trait Implementations§
impl Freeze for QueryPlanner
impl RefUnwindSafe for QueryPlanner
impl Send for QueryPlanner
impl Sync for QueryPlanner
impl Unpin for QueryPlanner
impl UnsafeUnpin for QueryPlanner
impl UnwindSafe for QueryPlanner
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
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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