lance_index::prefilter

Trait PreFilter

Source
pub trait PreFilter: Send + Sync {
    // Required methods
    fn wait_for_ready<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn is_empty(&self) -> bool;
    fn mask(&self) -> Arc<RowIdMask>;
    fn filter_row_ids<'a>(
        &self,
        row_ids: Box<dyn Iterator<Item = &'a u64> + 'a>,
    ) -> Vec<u64>;
}
Expand description

 Filter out row ids that we know are not relevant to the query.

This could be both rows that are deleted or a prefilter that should be applied to the search

Internal use only. No API stability guarantees.

Required Methods§

Source

fn wait_for_ready<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Waits for the prefilter to be fully loaded

The prefilter loads in the background while the rest of the index search is running. When you are ready to use the prefilter you must first call this method to ensure it is fully loaded. This allows filter_row_ids to be a synchronous method.

Source

fn is_empty(&self) -> bool

If the filter is empty.

Source

fn mask(&self) -> Arc<RowIdMask>

Get the row id mask for this prefilter

This method must be called after wait_for_ready

Source

fn filter_row_ids<'a>( &self, row_ids: Box<dyn Iterator<Item = &'a u64> + 'a>, ) -> Vec<u64>

Check whether a slice of row ids should be included in a query.

Returns a vector of indices into the input slice that should be included, also known as a selection vector.

This method must be called after wait_for_ready

Implementors§