refactor: rename search uuid -> file_uuid
This commit is contained in:
@@ -11,7 +11,7 @@ use crate::core::embedding::Embedder;
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct SmartSearchRequest {
|
||||
pub uuid: String,
|
||||
pub file_uuid: String,
|
||||
pub query: String,
|
||||
pub page: Option<usize>,
|
||||
pub page_size: Option<usize>,
|
||||
@@ -82,7 +82,7 @@ pub async fn smart_search(
|
||||
|
||||
// 2. Search Database (Drill-Down: Find Parents First)
|
||||
let db_parents: Vec<crate::core::db::postgres_db::SemanticSearchResult> = db
|
||||
.search_parent_chunks_semantic(&req.uuid, &embedding, limit)
|
||||
.search_parent_chunks_semantic(&req.file_uuid, &embedding, limit)
|
||||
.await
|
||||
.map_err(
|
||||
|e: anyhow::Error| -> (StatusCode, Json<serde_json::Value>) {
|
||||
|
||||
@@ -3916,7 +3916,7 @@ struct ParentChunkResponse {
|
||||
/// Search visual chunks based on criteria
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct VisualChunkSearchRequest {
|
||||
uuid: String,
|
||||
file_uuid: String,
|
||||
criteria: visual_chunk_search::VisualChunkSearchCriteria,
|
||||
}
|
||||
|
||||
@@ -3930,8 +3930,8 @@ async fn search_visual_chunks(
|
||||
State(state): State<AppState>,
|
||||
Json(req): Json<VisualChunkSearchRequest>,
|
||||
) -> Result<Json<VisualChunkSearchResponse>, StatusCode> {
|
||||
let criteria_hash = generate_visual_search_hash(&req.uuid, &req.criteria);
|
||||
let cache_key = keys::visual_search(&req.uuid, &criteria_hash);
|
||||
let criteria_hash = generate_visual_search_hash(&req.file_uuid, &req.criteria);
|
||||
let cache_key = keys::visual_search(&req.file_uuid, &criteria_hash);
|
||||
let ttl = state.mongo_cache.ttl_visual_search();
|
||||
|
||||
let chunks = state
|
||||
@@ -3941,7 +3941,7 @@ async fn search_visual_chunks(
|
||||
.await
|
||||
.map_err(|e| anyhow::anyhow!("PG init failed: {}", e))?;
|
||||
|
||||
visual_chunk_search::search_visual_chunks(&db, &req.uuid, &req.criteria)
|
||||
visual_chunk_search::search_visual_chunks(&db, &req.file_uuid, &req.criteria)
|
||||
.await
|
||||
.map_err(|e| anyhow::anyhow!("Visual search failed: {}", e))
|
||||
})
|
||||
|
||||
@@ -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