diff --git a/lib/segment/src/index/field_index/binary_index.rs b/lib/segment/src/index/field_index/binary_index.rs index 1397059f7f..79b2c84ff0 100644 --- a/lib/segment/src/index/field_index/binary_index.rs +++ b/lib/segment/src/index/field_index/binary_index.rs @@ -199,6 +199,16 @@ impl BinaryIndex { pub fn values_is_empty(&self, point_id: PointOffsetType) -> bool { self.values_count(point_id) == 0 } + + /// Check if the point has a true value + pub fn values_has_true(&self, point_id: PointOffsetType) -> bool { + self.memory.get(point_id).has_true() + } + + /// Check if the point has a false value + pub fn values_has_false(&self, point_id: PointOffsetType) -> bool { + self.memory.get(point_id).has_false() + } } impl PayloadFieldIndex for BinaryIndex { diff --git a/lib/segment/src/index/query_optimization/condition_converter.rs b/lib/segment/src/index/query_optimization/condition_converter.rs index 21823cdf40..c3dd0ca88f 100644 --- a/lib/segment/src/index/query_optimization/condition_converter.rs +++ b/lib/segment/src/index/query_optimization/condition_converter.rs @@ -234,6 +234,15 @@ pub fn get_match_checkers(index: &FieldIndex, cond_match: Match) -> Option { + Some(Box::new(move |point_id: PointOffsetType| { + if is_true { + index.values_has_true(point_id) + } else { + index.values_has_false(point_id) + } + })) + } _ => None, }, Match::Text(MatchText { text }) => match index {