add range query handling for ip via term dictionary

since IPs are mapped monotonically we can use the term dictionary for range queries
This commit is contained in:
Pascal Seitz
2022-10-18 13:05:32 +08:00
parent 491854155c
commit 1082ff60f9
2 changed files with 73 additions and 5 deletions

View File

@@ -404,9 +404,10 @@ impl QueryParser {
let bytes = base64::decode(phrase).map_err(QueryParserError::ExpectedBase64)?;
Ok(Term::from_field_bytes(field, &bytes))
}
FieldType::IpAddr(_) => Err(QueryParserError::UnsupportedQuery(
"Range query are not supported on ip field.".to_string(),
)),
FieldType::IpAddr(_) => {
let ip_v6 = IpAddr::from_str(phrase)?.into_ipv6_addr();
Ok(Term::from_field_ip_addr(field, ip_v6))
}
}
}