fix(zopk): Poprawka nazwy kolumny confidence_score w deduplikacji faktów

This commit is contained in:
Maciej Pienczyn 2026-01-17 11:16:53 +01:00
parent b3249f5b22
commit 0adb9bed0e

View File

@ -1978,15 +1978,15 @@ def find_duplicate_facts(
query = text(f"""
SELECT
f1.id as id1, f1.full_text as text1, f1.fact_type as type1,
f1.is_verified as verified1, f1.importance_score as score1,
f1.is_verified as verified1, f1.confidence_score as score1,
f2.id as id2, f2.full_text as text2, f2.fact_type as type2,
f2.is_verified as verified2, f2.importance_score as score2,
f2.is_verified as verified2, f2.confidence_score as score2,
similarity(f1.full_text, f2.full_text) as sim
FROM zopk_knowledge_facts f1
JOIN zopk_knowledge_facts f2 ON f1.id < f2.id
WHERE f1.full_text % f2.full_text
{type_filter}
ORDER BY sim DESC, GREATEST(f1.importance_score, f2.importance_score) DESC
ORDER BY sim DESC, COALESCE(GREATEST(f1.confidence_score, f2.confidence_score), 0) DESC
LIMIT :limit
""")
@ -1998,12 +1998,12 @@ def find_duplicate_facts(
'fact1': {
'id': row.id1, 'text': row.text1, 'fact_type': row.type1,
'is_verified': row.verified1,
'importance_score': float(row.score1) if row.score1 else 0
'confidence_score': float(row.score1) if row.score1 else 0
},
'fact2': {
'id': row.id2, 'text': row.text2, 'fact_type': row.type2,
'is_verified': row.verified2,
'importance_score': float(row.score2) if row.score2 else 0
'confidence_score': float(row.score2) if row.score2 else 0
},
'similarity': float(row.sim)
})