pub enum AllowedSet {
All,
Bitmap(Arc<AllowedBitmap>),
SortedVec(Arc<Vec<u64>>),
HashSet(Arc<HashSet<u64>>),
None,
}Expand description
The unified gate for candidate filtering
Every executor MUST check allowed_set.contains(doc_id) before
including any result. This is the structural enforcement of pushdown.
Variants§
All
All documents are allowed (no filter constraint)
Bitmap(Arc<AllowedBitmap>)
Bitmap representation (efficient for dense sets)
SortedVec(Arc<Vec<u64>>)
Sorted vector (efficient for sparse sets with iteration)
HashSet(Arc<HashSet<u64>>)
Hash set (efficient for random access)
None
No documents allowed (empty result shortcut)
Implementations§
Source§impl AllowedSet
impl AllowedSet
Sourcepub fn from_bitmap(bitmap: AllowedBitmap) -> Self
pub fn from_bitmap(bitmap: AllowedBitmap) -> Self
Create an AllowedSet from a bitmap
Sourcepub fn from_sorted_vec(ids: Vec<u64>) -> Self
pub fn from_sorted_vec(ids: Vec<u64>) -> Self
Create an AllowedSet from a sorted vector of doc IDs
Sourcepub fn from_iter(ids: impl IntoIterator<Item = u64>) -> Self
pub fn from_iter(ids: impl IntoIterator<Item = u64>) -> Self
Create an AllowedSet from an iterator of doc IDs
Sourcepub fn contains(&self, doc_id: u64) -> bool
pub fn contains(&self, doc_id: u64) -> bool
Check if a document ID is allowed
This is the core operation that executors MUST call.
Sourcepub fn cardinality(&self) -> Option<usize>
pub fn cardinality(&self) -> Option<usize>
Get the cardinality (number of allowed documents)
Returns None for All (unknown without universe size)
Sourcepub fn selectivity(&self, universe_size: usize) -> f64
pub fn selectivity(&self, universe_size: usize) -> f64
Compute selectivity against a universe of size N
Returns |S| / N, the fraction of allowed documents
Sourcepub fn intersect(&self, other: &AllowedSet) -> AllowedSet
pub fn intersect(&self, other: &AllowedSet) -> AllowedSet
Intersect with another AllowedSet
Sourcepub fn union(&self, other: &AllowedSet) -> AllowedSet
pub fn union(&self, other: &AllowedSet) -> AllowedSet
Union with another AllowedSet
Sourcepub fn iter(&self) -> AllowedSetIter<'_> ⓘ
pub fn iter(&self) -> AllowedSetIter<'_> ⓘ
Iterate over allowed document IDs
Note: For All, this returns an empty iterator (unknown universe)
Trait Implementations§
Source§impl Clone for AllowedSet
impl Clone for AllowedSet
Source§fn clone(&self) -> AllowedSet
fn clone(&self) -> AllowedSet
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AllowedSet
impl Debug for AllowedSet
Auto Trait Implementations§
impl Freeze for AllowedSet
impl RefUnwindSafe for AllowedSet
impl Send for AllowedSet
impl Sync for AllowedSet
impl Unpin for AllowedSet
impl UnwindSafe for AllowedSet
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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