Include binary index on match value (#2744)

This commit is contained in:
Luis Cossío
2023-10-02 04:56:44 -03:00
committed by GitHub
parent 2e4729a1f3
commit a67168bb6f
2 changed files with 19 additions and 0 deletions

View File

@@ -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 {

View File

@@ -234,6 +234,15 @@ pub fn get_match_checkers(index: &FieldIndex, cond_match: Match) -> Option<Condi
.map_or(false, |values| values.iter().any(|i| i == &value))
}))
}
(ValueVariants::Bool(is_true), FieldIndex::BinaryIndex(index)) => {
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 {