85d5e1fe51
- Fix trace_id SQL type mismatch: i64 → i32 in profile.rs structs and queries - Add /ocr /asr /asrx search filter suffix to keyword/semantic/smart search - Fix fetch_ocr_texts to handle both OCR data formats (string array + object array) - Add has_ocr trigger for Rule1 chunk ingestion in job_worker.rs - Add search_bm25 chunk_type filter parameter - Fix single-frame video clip duration (0-frame → 1-frame minimum) - Re-run Rule1 for 14 files with stuck OCR in pre_chunks
38 lines
1.1 KiB
Rust
38 lines
1.1 KiB
Rust
use anyhow::{Context, Result};
|
|
use momentry_core::core::db::{Database, PostgresDb};
|
|
use std::env;
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<()> {
|
|
env::set_var("RUST_LOG", "info");
|
|
|
|
println!("=== 簡體中文轉換測試 ===\n");
|
|
|
|
// 初始化 PostgreSQL
|
|
let pg = PostgresDb::init()
|
|
.await
|
|
.context("Failed to initialize PostgreSQL database")?;
|
|
|
|
// 測試查詢:簡體中文
|
|
let test_queries = vec!["团体", "视频", "文件"];
|
|
|
|
for query_str in test_queries {
|
|
println!("\n🔍 測試查詢 (簡體): '{}'", query_str);
|
|
|
|
// 顯示轉換後的 tsquery
|
|
match pg.prepare_tsquery(query_str).await {
|
|
Ok(tsquery) => println!(" TSQUERY: {}", tsquery),
|
|
Err(e) => println!(" TSQUERY 錯誤: {}", e),
|
|
}
|
|
|
|
// 執行搜索
|
|
let results = pg.search_bm25(query_str, None, None, 5).await?;
|
|
println!(" 找到 {} 筆結果", results.len());
|
|
for (i, r) in results.iter().enumerate() {
|
|
println!(" {}. [{}] {}", i + 1, r.uuid, r.text);
|
|
}
|
|
}
|
|
|
|
Ok(())
|
|
}
|