Skip to content

Commit

Permalink
syntax for min_should
Browse files Browse the repository at this point in the history
  • Loading branch information
agourlay committed Mar 5, 2024
1 parent 076e05b commit 452e4bf
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/filters.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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<Item = qdrant::Condition>) -> Self {
Self {
must: conds.into_iter().collect(),
Expand All @@ -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<Item = qdrant::Condition>) -> 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<Item = qdrant::Condition>) -> Self {
Self {
Expand Down

0 comments on commit 452e4bf

Please sign in to comment.