pub struct Filter {
pub equals: HashMap<String, Value>,
pub in: HashMap<String, Vec<Value>>,
pub gte: HashMap<String, f64>,
pub lte: HashMap<String, f64>,
}Expand description
Metadata filter applied to similarity search.
All conditions on a filter combine with AND semantics. An empty filter matches everything (the same as no filter at all).
Fields§
§equals: HashMap<String, Value>Metadata key/value pairs every result must match exactly.
Compared with serde_json == after both sides are coerced to
serde_json::Value.
in: HashMap<String, Vec<Value>>Metadata keys whose values must appear in the listed set.
Equivalent to metadata[key] in values.
gte: HashMap<String, f64>Numeric metadata keys with >= lower bound.
lte: HashMap<String, f64>Numeric metadata keys with <= upper bound.
Implementations§
Source§impl Filter
impl Filter
Sourcepub fn equals(self, key: impl Into<String>, value: impl Into<Value>) -> Self
pub fn equals(self, key: impl Into<String>, value: impl Into<Value>) -> Self
Builder: require metadata[key] == value.
Sourcepub fn one_of<I, V>(self, key: impl Into<String>, values: I) -> Self
pub fn one_of<I, V>(self, key: impl Into<String>, values: I) -> Self
Builder: require metadata[key] to be one of values.
Sourcepub fn gte(self, key: impl Into<String>, n: f64) -> Self
pub fn gte(self, key: impl Into<String>, n: f64) -> Self
Builder: require metadata[key] >= n (numeric).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Filter
impl<'de> Deserialize<'de> for Filter
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl JsonSchema for Filter
impl JsonSchema for Filter
Source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref keyword. Read moreAuto Trait Implementations§
impl Freeze for Filter
impl RefUnwindSafe for Filter
impl Send for Filter
impl Sync for Filter
impl Unpin for Filter
impl UnsafeUnpin for Filter
impl UnwindSafe for Filter
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