WeKnora/internal/application
lazyayuan 29c52b0342 fix(evaluation): fix retrieval metrics by mapping chunks back to passage IDs
Two issues caused retrieval metrics (precision, recall, NDCG, MRR, MAP)
to always be 0:

1. recordFinish compared SearchResult.ChunkIndex (the chunk's ordinal
   position in the knowledge base) against QAPair.PIDs (the dataset's
   original passage IDs). These are different ID spaces that never match.
   Fix: use content-based matching to map each retrieved chunk back to
   its source passage, with deduplication for multi-chunk passages.

2. getPassageList had an off-by-one error: make([]string, maxPID) with
   loop i < maxPID dropped the passage with the highest PID.
   Fix: use maxPID+1 and i <= maxPID.

Also adds fallback from rerankResult to searchResult when no rerank
model is configured, matching the pattern in the working copy.
2026-07-31 11:05:13 +08:00
..
repository fix: 修复 SQLite 下删除 DataSource 失败 2026-07-31 11:00:47 +08:00
service fix(evaluation): fix retrieval metrics by mapping chunks back to passage IDs 2026-07-31 11:05:13 +08:00