feat: evaluate top 5 candidates, early-exit on NIP/REGON/KRS match
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions

Increase candidate pool from 3 to 5. Stop evaluating once a
candidate matches NIP/REGON/KRS (100% certainty).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Maciej Pienczyn 2026-02-21 09:28:24 +01:00
parent 11184c5a58
commit 409557ceab

View File

@ -263,7 +263,7 @@ class WebsiteDiscoveryService:
best_score = -1
seen_urls = set()
for brave_result in urls[:3]:
for brave_result in urls[:5]:
url = _normalize_url_to_root(brave_result['url'])
# Skip duplicate root URLs (e.g. /kontakt/ and /about/ on same domain)
@ -344,6 +344,10 @@ class WebsiteDiscoveryService:
best_score = score
best_candidate = candidate_data
# NIP/REGON/KRS match = certain, stop evaluating
if signals.get('nip') or signals.get('regon') or signals.get('krs'):
break
if not best_candidate:
# All URLs already exist as candidates
return {'status': 'exists', 'company_id': company.id}