fix: search frames SQL alias bug, visual search serde default, identity JSON hyphen lookup

This commit is contained in:
Accusys
2026-05-18 02:52:27 +08:00
parent 53d80db2b3
commit 02cca7beda
3 changed files with 31 additions and 11 deletions

View File

@@ -65,6 +65,7 @@ pub enum SearchResult {
// Primary: frame-accurate position
start_frame: i64,
end_frame: i64,
fps: f64,
// Reference: time derived from frames (subject to FPS variation)
start_time: f64,
end_time: f64,
@@ -340,7 +341,7 @@ async fn search_chunks(
let chunk_table = schema::table_name("chunk");
let mut sql = format!(
"SELECT chunk_id, chunk_type, start_time, end_time, start_frame, end_frame, text_content, content FROM {} WHERE file_uuid = '{}'",
"SELECT chunk_id, chunk_type, start_time, end_time, (start_time * fps)::bigint as start_frame, (end_time * fps)::bigint as end_frame, fps, text_content, content FROM {} WHERE file_uuid = '{}'",
chunk_table, uuid
);
if let Some(tr) = &req.time_range {
@@ -432,6 +433,7 @@ async fn search_chunks(
f64,
i64,
i64,
f64,
Option<String>,
Option<serde_json::Value>,
)> = sqlx::query_as(&sql).fetch_all(db.pool()).await?;
@@ -446,6 +448,7 @@ async fn search_chunks(
end_time,
start_frame,
end_frame,
fps,
text_content,
content,
)| {
@@ -476,6 +479,7 @@ async fn search_chunks(
end_time,
start_frame,
end_frame,
fps,
score,
text,
speaker_id,
@@ -666,7 +670,7 @@ async fn search_frames_internal_v2(
);
if let Some(uuid) = &req.file_uuid {
sql.push_str(&format!(" AND fd.file_uuid = '{}'", uuid));
sql.push_str(&format!(" AND v.file_uuid = '{}'", uuid));
}
if let Some(tr) = &req.time_range {
sql.push_str(&format!(