Remove hotloop's spans

This commit is contained in:
ManyTheFish 2024-08-14 14:33:36 +02:00
parent ade54493ab
commit 0f965d3574

View File

@ -269,28 +269,16 @@ fn extract_facet_string_docids_settings<R: io::Read + io::Seek>(
} }
/// Normalizes the facet string and truncates it to the max length. /// Normalizes the facet string and truncates it to the max length.
#[tracing::instrument(level = "trace", skip_all, target = "indexing::extract")]
fn normalize_facet_string(facet_string: &str, locales: Option<&[Language]>) -> String { fn normalize_facet_string(facet_string: &str, locales: Option<&[Language]>) -> String {
let options: NormalizerOption = NormalizerOption { lossy: true, ..Default::default() }; let options: NormalizerOption = NormalizerOption { lossy: true, ..Default::default() };
let mut detection = StrDetection::new(facet_string, locales); let mut detection = StrDetection::new(facet_string, locales);
let script = { let script = detection.script();
let span = tracing::trace_span!(target: "indexing::extract::extract_facet_string_docids", "detect_script"); // Detect the language of the facet string only if several locales are explicitly provided.
let _entered = span.enter(); let language = match locales {
Some(&[language]) => Some(language),
detection.script() Some(multiple_locales) if multiple_locales.len() > 1 => detection.language(),
}; _ => None,
let language = {
let span = tracing::trace_span!(target: "indexing::extract::extract_facet_string_docids", "detect_language");
let _entered = span.enter();
// Detect the language of the facet string only if several locales are explicitly provided.
match locales {
Some(&[language]) => Some(language),
Some(multiple_locales) if multiple_locales.len() > 1 => detection.language(),
_ => None,
}
}; };
let token = Token { let token = Token {
@ -300,10 +288,6 @@ fn normalize_facet_string(facet_string: &str, locales: Option<&[Language]>) -> S
..Default::default() ..Default::default()
}; };
let span =
tracing::trace_span!(target: "indexing::extract::extract_facet_string_docids", "normalize");
let _entered = span.enter();
// truncate the facet string to the max length // truncate the facet string to the max length
token token
.normalize(&options) .normalize(&options)