mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-05-30 23:20:40 +00:00
add ip field
This commit is contained in:
@@ -400,6 +400,7 @@ impl QueryParser {
|
||||
let bytes = base64::decode(phrase).map_err(QueryParserError::ExpectedBase64)?;
|
||||
Ok(Term::from_field_bytes(field, &bytes))
|
||||
}
|
||||
FieldType::Ip(_) => Ok(Term::from_field_text(field, phrase)),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -506,6 +507,13 @@ impl QueryParser {
|
||||
let bytes_term = Term::from_field_bytes(field, &bytes);
|
||||
Ok(vec![LogicalLiteral::Term(bytes_term)])
|
||||
}
|
||||
FieldType::Ip(ref option) => {
|
||||
if !option.is_indexed() {
|
||||
return Err(QueryParserError::FieldNotIndexed(field_name.to_string()));
|
||||
}
|
||||
let text_term = Term::from_field_text(field, phrase);
|
||||
Ok(vec![LogicalLiteral::Term(text_term)])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user