refactor: rename search uuid -> file_uuid
This commit is contained in:
@@ -15,7 +15,7 @@ use crate::core::db::{schema, Database, PostgresDb};
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct UniversalSearchRequest {
|
||||
pub query: String,
|
||||
pub uuid: Option<String>,
|
||||
pub file_uuid: Option<String>,
|
||||
#[serde(default)]
|
||||
pub types: Vec<String>, // chunk, frame, person
|
||||
pub time_range: Option<[f64; 2]>,
|
||||
@@ -274,7 +274,7 @@ pub async fn search_persons(
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct FrameSearchRequest {
|
||||
pub uuid: Option<String>,
|
||||
pub file_uuid: Option<String>,
|
||||
pub object_class: Option<String>,
|
||||
pub ocr_text: Option<String>,
|
||||
pub face_id: Option<String>,
|
||||
@@ -292,7 +292,7 @@ pub struct FrameSearchResponse {
|
||||
pub struct FrameResult {
|
||||
pub frame_number: i64,
|
||||
pub timestamp: f64,
|
||||
pub uuid: String,
|
||||
pub file_uuid: String,
|
||||
pub objects: Option<Vec<serde_json::Value>>,
|
||||
pub ocr_texts: Option<Vec<String>>,
|
||||
pub faces: Option<Vec<serde_json::Value>>,
|
||||
@@ -333,9 +333,9 @@ async fn search_chunks(
|
||||
req: &UniversalSearchRequest,
|
||||
) -> Result<Vec<SearchResult>, anyhow::Error> {
|
||||
// uuid is required for chunk search - chunk_id is only unique within a video
|
||||
let uuid = match &req.uuid {
|
||||
let uuid = match &req.file_uuid {
|
||||
Some(u) => u.replace('\'', "''"),
|
||||
None => return Err(anyhow::anyhow!("uuid is required for chunk search")),
|
||||
None => return Err(anyhow::anyhow!("file_uuid is required for chunk search")),
|
||||
};
|
||||
|
||||
let chunk_table = schema::table_name("chunk");
|
||||
@@ -501,7 +501,7 @@ async fn search_frames_internal(
|
||||
table, video_table
|
||||
);
|
||||
|
||||
if let Some(uuid) = &req.uuid {
|
||||
if let Some(uuid) = &req.file_uuid {
|
||||
sql.push_str(&format!(" AND v.file_uuid = '{}'", uuid));
|
||||
}
|
||||
if let Some(tr) = &req.time_range {
|
||||
@@ -665,8 +665,8 @@ async fn search_frames_internal_v2(
|
||||
table, video_table
|
||||
);
|
||||
|
||||
if let Some(uuid) = &req.uuid {
|
||||
sql.push_str(&format!(" AND v.file_uuid = '{}'", uuid));
|
||||
if let Some(uuid) = &req.file_uuid {
|
||||
sql.push_str(&format!(" AND fd.file_uuid = '{}'", uuid));
|
||||
}
|
||||
if let Some(tr) = &req.time_range {
|
||||
sql.push_str(&format!(
|
||||
@@ -721,7 +721,7 @@ async fn search_frames_internal_v2(
|
||||
FrameResult {
|
||||
frame_number,
|
||||
timestamp,
|
||||
uuid,
|
||||
file_uuid: uuid,
|
||||
objects: objects.map(|arr| arr.iter().map(|v| v.clone()).collect()),
|
||||
ocr_texts,
|
||||
faces,
|
||||
|
||||
Reference in New Issue
Block a user