mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-01-07 09:32:54 +00:00
rename constructor to be more explicit
This commit is contained in:
@@ -257,8 +257,11 @@ pub struct JsonTermWriter<'a> {
|
||||
}
|
||||
|
||||
impl<'a> JsonTermWriter<'a> {
|
||||
// Prepares writing terms for a given field
|
||||
pub fn initialize(field: Field, json_path: &str, term_buffer: &'a mut Term) -> Self {
|
||||
pub fn from_field_and_json_path(
|
||||
field: Field,
|
||||
json_path: &str,
|
||||
term_buffer: &'a mut Term,
|
||||
) -> Self {
|
||||
term_buffer.set_field(Type::Json, field);
|
||||
let mut json_term_writer = Self::wrap(term_buffer);
|
||||
for segment in json_path.split('.') {
|
||||
|
||||
@@ -672,7 +672,8 @@ fn generate_literals_for_json_object(
|
||||
) -> Result<Vec<LogicalLiteral>, QueryParserError> {
|
||||
let mut logical_literals = Vec::new();
|
||||
let mut term = Term::new();
|
||||
let mut json_term_writer = JsonTermWriter::initialize(field, json_path, &mut term);
|
||||
let mut json_term_writer =
|
||||
JsonTermWriter::from_field_and_json_path(field, json_path, &mut term);
|
||||
if let Some(term) = convert_to_fast_value_and_get_term(&mut json_term_writer, phrase) {
|
||||
logical_literals.push(LogicalLiteral::Term(term));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user