fix: keyword search for OCR text
- Fix OCR confidence threshold: 0.5 → 0.2 - Fix fetch_ocr_texts frame calculation (use start_frame from DB) - Fix text_match filter to use text_content instead of summary - Process all merged results (not just top 30) to include keyword results - Add logging for keyword search debugging Fixes issue where OCR text like 'AUDIO MONITORING' and 'thunderbolt' could not be found via keyword search.
This commit is contained in:
@@ -7,7 +7,7 @@ use sqlx::{PgPool, Row};
|
||||
use std::collections::BTreeMap;
|
||||
use tracing::{info, warn};
|
||||
|
||||
const OCR_CONFIDENCE_THRESHOLD: f64 = 0.5;
|
||||
const OCR_CONFIDENCE_THRESHOLD: f64 = 0.2;
|
||||
|
||||
pub async fn execute_rule1(db: &PostgresDb, file_uuid: &str, fps: f64) -> Result<usize> {
|
||||
let pool = db.pool();
|
||||
@@ -219,11 +219,10 @@ async fn fetch_ocr_texts(
|
||||
|
||||
let mut map: BTreeMap<i64, Vec<String>> = BTreeMap::new();
|
||||
for row in rows {
|
||||
let start_time: f64 = row.try_get("start_time").unwrap_or(0.0);
|
||||
let start_frame: i64 = row.try_get("start_frame").unwrap_or(0);
|
||||
let end_time_raw: Option<f64> = row.try_get("end_time").ok();
|
||||
let data: Value = row.try_get("data").unwrap_or(Value::Null);
|
||||
|
||||
let start_frame = (start_time * fps) as i64;
|
||||
let end_frame = end_time_raw
|
||||
.filter(|t| *t > 0.0)
|
||||
.map(|t| (t * fps) as i64)
|
||||
|
||||
Reference in New Issue
Block a user