From 6e0b9f9e878963a057edbb443a1dbba7f5ed86aa Mon Sep 17 00:00:00 2001 From: gkumbhat Date: Fri, 23 Aug 2024 14:09:26 -0500 Subject: [PATCH] :bug: Fix offset for standalone content results Signed-off-by: gkumbhat --- src/orchestrator/unary.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/orchestrator/unary.rs b/src/orchestrator/unary.rs index ae60c6d9..43e96cbb 100644 --- a/src/orchestrator/unary.rs +++ b/src/orchestrator/unary.rs @@ -594,10 +594,14 @@ pub async fn detect_content( let results = chunks .into_iter() .zip(response) - .flat_map(|(_chunk, response)| { + .flat_map(|(chunk, response)| { response .into_iter() - .filter_map(|resp| (resp.score >= threshold).then_some(resp)) + .filter_map(|mut resp| { + resp.start += chunk.offset; + resp.end += chunk.offset; + (resp.score >= threshold).then_some(resp) + }) .collect::>() }) .collect::>();