fix: skip empty ASRX segments in Rule 1, fix chunk_id numbering
- Skip chunks where both ASRX text and OCR text are empty - Use count-based chunk_id instead of index to avoid gaps - This ensures PostgreSQL and Qdrant chunk counts match
This commit is contained in:
@@ -38,6 +38,11 @@ pub async fn execute_rule1(db: &PostgresDb, file_uuid: &str, fps: f64) -> Result
|
||||
format!("{} {}", seg.text, ocr_text)
|
||||
};
|
||||
|
||||
// Skip chunks with no text (empty ASRX and no OCR)
|
||||
if combined_text.trim().is_empty() {
|
||||
continue;
|
||||
}
|
||||
|
||||
let metadata = serde_json::json!({
|
||||
"language": seg.language,
|
||||
});
|
||||
@@ -50,7 +55,7 @@ pub async fn execute_rule1(db: &PostgresDb, file_uuid: &str, fps: f64) -> Result
|
||||
let chunk = Chunk::from_seconds(
|
||||
file_id as i32,
|
||||
file_uuid.to_string(),
|
||||
format!("{}", idx),
|
||||
format!("{}", count),
|
||||
ChunkType::Sentence,
|
||||
ChunkRule::Rule1,
|
||||
seg.start_time,
|
||||
|
||||
Reference in New Issue
Block a user