Skip to main content

Filter

Trait Filter 

Source
pub trait Filter {
    // Required method
    fn allows(&self, tag: u64) -> bool;
}
Expand description

What decides whether the scan bothers with a member.

A filtered vector search is a recall lottery when the filter runs after the search: ask for ten English passages, get the best forty by vector, find three of them are English, and the other seven English passages that were nearer never had a chance. The fix is to filter inside the scan, so that only members that can be answers are ranked at all, and that means the thing the filter reads has to sit next to the codes rather than behind a lookup into somebody else’s table.

So every member carries a u64 tag, given at insert, and a filter is a predicate on that tag. What the tag means is the caller’s business. A handful of low cardinality attributes pack into it exactly, one field each, and the filter is then exact. Anything wider goes through Signature, which is exact in the direction that matters: it never rejects a member that should have matched, so the caller’s real predicate over the answers still decides.

Required Methods§

Source

fn allows(&self, tag: u64) -> bool

Whether a member with this tag is worth ranking.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Filter for Any

Source§

impl Filter for Signature

Source§

impl<F: Fn(u64) -> bool> Filter for F