lance_index::scalar

Trait AnyQuery

Source
pub trait AnyQuery:
    Debug
    + Any
    + Send
    + Sync {
    // Required methods
    fn as_any(&self) -> &dyn Any;
    fn format(&self, col: &str) -> String;
    fn to_expr(&self, col: String) -> Expr;
    fn dyn_eq(&self, other: &dyn AnyQuery) -> bool;
}
Expand description

Different scalar indices may support different kinds of queries

For example, a btree index can support a wide range of queries (e.g. x > 7) while an index based on FTS only supports queries like “x LIKE ‘foo’”

This trait is used when we need an object that can represent any kind of query

Note: if you are implementing this trait for a query type then you probably also need to implement the crate::scalar::expression::ScalarQueryParser trait to create instances of your query at parse time.

Required Methods§

Source

fn as_any(&self) -> &dyn Any

Cast the query as Any to allow for downcasting

Source

fn format(&self, col: &str) -> String

Format the query as a string

Source

fn to_expr(&self, col: String) -> Expr

Convert the query to a datafusion expression

Source

fn dyn_eq(&self, other: &dyn AnyQuery) -> bool

Compare this query to another query

Trait Implementations§

Source§

impl PartialEq for dyn AnyQuery

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Implementors§