Skip to content

Commit afa5f13

Browse files
committed
review nits
1 parent b1bc383 commit afa5f13

1 file changed

Lines changed: 21 additions & 8 deletions

File tree

lib/collection/src/problems/unindexed_field.rs

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ impl<'a> Extractor<'a> {
366366
);
367367
return;
368368
}
369-
// Any index will suffice
369+
// Any index will suffice to get the satellite null index
370370
Condition::IsEmpty(is_empty) => {
371371
key = &is_empty.is_empty.key;
372372
required_index = all_indexes().collect();
@@ -396,7 +396,7 @@ impl<'a> Extractor<'a> {
396396
match self.payload_schema.get(key) {
397397
Some(index_info) => {
398398
// check if the index present has the right capabilities
399-
let index_field_types = schema_capacities(index_info);
399+
let index_field_types = schema_capabilities(index_info);
400400
let already_indexed = required_indexes
401401
.iter()
402402
.any(|required| index_field_types.contains(required));
@@ -424,7 +424,11 @@ impl<'a> Extractor<'a> {
424424
VariableId::Score(_) => return,
425425
VariableId::Payload(json_path) => {
426426
key = json_path;
427-
required_index = vec![FieldIndexType::IntMatch, FieldIndexType::FloatRange];
427+
required_index = vec![
428+
FieldIndexType::IntMatch,
429+
FieldIndexType::IntRange,
430+
FieldIndexType::FloatRange,
431+
];
428432
}
429433
VariableId::Condition(_) => return,
430434
}
@@ -532,13 +536,19 @@ enum FieldIndexType {
532536
Geo,
533537
}
534538

535-
fn schema_capacities(value: &PayloadFieldSchema) -> HashSet<FieldIndexType> {
539+
fn schema_capabilities(value: &PayloadFieldSchema) -> HashSet<FieldIndexType> {
536540
let mut index_types = HashSet::new();
537541
match value {
538542
PayloadFieldSchema::FieldType(payload_schema_type) => match payload_schema_type {
539543
PayloadSchemaType::Keyword => index_types.insert(FieldIndexType::KeywordMatch),
540-
PayloadSchemaType::Integer => index_types.insert(FieldIndexType::IntMatch),
541-
PayloadSchemaType::Uuid => index_types.insert(FieldIndexType::UuidMatch),
544+
PayloadSchemaType::Integer => {
545+
index_types.insert(FieldIndexType::IntMatch);
546+
index_types.insert(FieldIndexType::IntRange)
547+
}
548+
PayloadSchemaType::Uuid => {
549+
index_types.insert(FieldIndexType::UuidMatch);
550+
index_types.insert(FieldIndexType::UuidRange)
551+
}
542552
PayloadSchemaType::Bool => index_types.insert(FieldIndexType::BoolMatch),
543553
PayloadSchemaType::Float => index_types.insert(FieldIndexType::FloatRange),
544554
PayloadSchemaType::Geo => index_types.insert(FieldIndexType::Geo),
@@ -561,7 +571,10 @@ fn schema_capacities(value: &PayloadFieldSchema) -> HashSet<FieldIndexType> {
561571
// unifying match arm types
562572
true
563573
}
564-
PayloadSchemaParams::Uuid(_) => index_types.insert(FieldIndexType::UuidMatch),
574+
PayloadSchemaParams::Uuid(_) => {
575+
index_types.insert(FieldIndexType::UuidMatch);
576+
index_types.insert(FieldIndexType::UuidRange)
577+
}
565578
PayloadSchemaParams::Bool(_) => index_types.insert(FieldIndexType::BoolMatch),
566579
PayloadSchemaParams::Float(_) => index_types.insert(FieldIndexType::FloatRange),
567580
PayloadSchemaParams::Geo(_) => index_types.insert(FieldIndexType::Geo),
@@ -616,7 +629,7 @@ mod tests {
616629
..Default::default()
617630
});
618631
let schema = PayloadFieldSchema::FieldParams(params);
619-
let index_types = schema_capacities(&schema);
632+
let index_types = schema_capabilities(&schema);
620633
assert!(index_types.contains(&FieldIndexType::IntMatch));
621634
assert!(index_types.contains(&FieldIndexType::IntRange));
622635
}

0 commit comments

Comments
 (0)