Merge pull request #1672 from quickwit-oss/allow_range_without_indexed

Allow range query on fastfield without INDEXED
This commit is contained in:
PSeitz
2022-11-14 12:45:12 +08:00
committed by GitHub
2 changed files with 5 additions and 3 deletions

View File

@@ -333,7 +333,9 @@ impl QueryParser {
) -> Result<Term, QueryParserError> {
let field_entry = self.schema.get_field_entry(field);
let field_type = field_entry.field_type();
if !field_type.is_indexed() {
let is_ip_and_fast = field_type.is_ip_addr() && field_type.is_fast();
if !field_type.is_indexed() && !is_ip_and_fast {
return Err(QueryParserError::FieldNotIndexed(
field_entry.name().to_string(),
));

View File

@@ -269,7 +269,7 @@ mod tests {
use super::*;
use crate::collector::Count;
use crate::query::QueryParser;
use crate::schema::{Schema, FAST, INDEXED, STORED, STRING};
use crate::schema::{Schema, FAST, STORED, STRING};
use crate::Index;
#[derive(Clone, Debug)]
@@ -328,7 +328,7 @@ mod tests {
pub fn create_index_from_docs(docs: &[Doc]) -> Index {
let mut schema_builder = Schema::builder();
let ip_field = schema_builder.add_ip_addr_field("ip", INDEXED | STORED | FAST);
let ip_field = schema_builder.add_ip_addr_field("ip", STORED | FAST);
let text_field = schema_builder.add_text_field("id", STRING | STORED);
let schema = schema_builder.build();
let index = Index::create_in_ram(schema);