feat: score-based search, LLM re-ranking endpoint, video title search, pipeline module

Core search changes:
- Replace RRF with score-based merge (max of semantic/keyword/identity)
- Add video title ILIKE search for brand/name queries (score 0.9)
- Add /api/v1/search/llm-smart endpoint with Gemma 4 re-ranking
- Fix LLM JSON parsing (markdown fences, empty responses)

Infrastructure:
- Rebuild Qdrant collection (clear 347K contaminated points)
- Add dotenv loading to main.rs for config parity
- Implement store_pre_chunk in postgres_db.rs

Pipeline module (WordPress):
- store-asrx, rule1, vectorize, phase1, complete endpoints
- CLI commands for pipeline operations

Docs:
- SEARCH_SCORE_IMPROVEMENT.md (score-based merge proposal)
This commit is contained in:
Accusys
2026-06-04 07:40:41 +08:00
parent e1572907ae
commit 834b0d4865
14 changed files with 835 additions and 31 deletions
+31 -3
View File
@@ -3308,10 +3308,38 @@ impl PostgresDb {
pub async fn store_pre_chunk(
&self,
_uuid: &str,
_chunk_type: &str,
_data: serde_json::Value,
uuid: &str,
processor_type: &str,
data: serde_json::Value,
) -> Result<()> {
let table = schema::table_name("pre_chunks");
let pre_chunk: PreChunk = serde_json::from_value(data)?;
let start_time = pre_chunk.start_frame as f64 / pre_chunk.fps;
let end_time = pre_chunk.end_frame as f64 / pre_chunk.fps;
sqlx::query(&format!(
"INSERT INTO {} (file_uuid, file_id, source_type, source_file, chunk_type, \
start_frame, end_frame, start_time, end_time, fps, data, text_content, \
processed, chunk_id, processor_type) \
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15)",
table
))
.bind(uuid)
.bind(pre_chunk.file_id)
.bind(&pre_chunk.source_type)
.bind(&pre_chunk.source_file)
.bind(&pre_chunk.chunk_type)
.bind(pre_chunk.start_frame)
.bind(pre_chunk.end_frame)
.bind(start_time)
.bind(end_time)
.bind(pre_chunk.fps)
.bind(&pre_chunk.raw_json)
.bind(&pre_chunk.text_content)
.bind(pre_chunk.processed)
.bind(&pre_chunk.chunk_id)
.bind(processor_type)
.execute(&self.pool)
.await?;
Ok(())
}