From 27278ecb82f16fe6636bae6bc558d851e2d3b3ac Mon Sep 17 00:00:00 2001 From: DustInDark <2350416+hitenkoku@users.noreply.github.com> Date: Sat, 10 Feb 2024 23:27:54 +0900 Subject: [PATCH] fix(search,afterfact): fixed allfieldinfo in json output of search command #1251 --- src/afterfact.rs | 4 ++-- src/timeline/search.rs | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/afterfact.rs b/src/afterfact.rs index 8476dc902..fde7f8c14 100644 --- a/src/afterfact.rs +++ b/src/afterfact.rs @@ -1637,8 +1637,8 @@ pub fn output_json_str( let mut children_output_order = vec![]; for contents in details_target_stock.iter() { let (key, value) = contents.split_once(':').unwrap_or_default(); - let output_key = _convert_valid_json_str(&[key], false); - let fmted_val = _convert_valid_json_str(&[value.trim_start()], false); + let output_key = _convert_valid_json_str(&[key.trim()], false); + let fmted_val = _convert_valid_json_str(&[value.trim()], false); if let RawEntryMut::Vacant(_) = children_output_stock .raw_entry_mut() .from_key(output_key.as_str()) diff --git a/src/timeline/search.rs b/src/timeline/search.rs index 591b9cd23..206880f97 100644 --- a/src/timeline/search.rs +++ b/src/timeline/search.rs @@ -447,6 +447,14 @@ pub fn search_result_dsp_msg( file_wtr.as_mut().unwrap().write_record(&record_data).ok(); } else if output.is_some() && (json_output || jsonl_output) { file_wtr.as_mut().unwrap().write_field("{").ok(); + let mut detail_infos: HashMap> = HashMap::default(); + detail_infos.insert( + CompactString::from("#AllFieldInfo"), + all_field_info + .split('¦') + .map(CompactString::from) + .collect_vec(), + ); let (output_json_str_ret, _) = output_json_str( &vec![ ( @@ -481,7 +489,7 @@ pub fn search_result_dsp_msg( false, false, false, - &[&HashMap::default(), &HashMap::default()], + &[&detail_infos, &HashMap::default()], ); file_wtr