From 452e4bf784a1a793d102e2424b592ef62967f5d6 Mon Sep 17 00:00:00 2001 From: Arnaud Gourlay Date: Tue, 5 Mar 2024 15:38:48 +0100 Subject: [PATCH] syntax for min_should --- src/filters.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/filters.rs b/src/filters.rs index 311734e..214abdc 100644 --- a/src/filters.rs +++ b/src/filters.rs @@ -1,7 +1,7 @@ use crate::qdrant::condition::ConditionOneOf; use crate::qdrant::points_selector::PointsSelectorOneOf; use crate::qdrant::r#match::MatchValue; -use crate::qdrant::{self, DatetimeRange}; +use crate::qdrant::{self, DatetimeRange, MinShould}; use crate::qdrant::{ Condition, FieldCondition, Filter, GeoBoundingBox, GeoPolygon, GeoRadius, HasIdCondition, IsEmptyCondition, IsNullCondition, NestedCondition, PointId, PointsSelector, Range, @@ -91,7 +91,7 @@ impl qdrant::Filter { }) } - /// create a Filter where all of the conditions must be satisfied + /// create a Filter where all the conditions must be satisfied pub fn must(conds: impl IntoIterator) -> Self { Self { must: conds.into_iter().collect(), @@ -107,6 +107,17 @@ impl qdrant::Filter { } } + /// create a Filter where at least a minimum amount of given conditions should be statisfied + pub fn min_should(min_count: u64, conds: impl IntoIterator) -> Self { + Self { + min_should: Some(MinShould { + min_count, + conditions: conds.into_iter().collect(), + }), + ..Default::default() + } + } + /// create a Filter where none of the conditions must be satisfied pub fn must_not(conds: impl IntoIterator) -> Self { Self {