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:
Accusys
2026-07-04 12:41:40 +08:00
parent e4d6fbac50
commit 4e8c0ea5b9
2 changed files with 58 additions and 1 deletions
+6 -1
View File
@@ -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,