improve(wizard): include NIP in website discovery search query for better results
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

Searches 'PROS POLAND NIP 5851491213 Sopot' instead of just company name.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Maciej Pienczyn 2026-04-03 12:33:41 +02:00
parent 618bb0f75f
commit 6657bf228f

View File

@ -454,8 +454,7 @@ def wizard_discover_website():
if not company:
return jsonify({'success': False, 'error': 'Firma nie znaleziona'}), 404
# Use shorter name for better search results
# Strip legal form suffixes for cleaner query
# Build a clean short name for search
search_name = company.name
for suffix in ['SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ', 'SP. Z O.O.',
'SPÓŁKA AKCYJNA', 'S.A.', 'SPÓŁKA KOMANDYTOWA', 'SP.K.',
@ -466,9 +465,14 @@ def wizard_discover_website():
from services.website_discovery_service import WebsiteDiscoveryService
service = WebsiteDiscoveryService(db=db)
# Temporarily set a cleaner name for discovery query
# Temporarily override company.name with enriched search query
# Include NIP and city for better matching
original_name = company.name
company.name = search_name
parts = [search_name]
if company.nip:
parts.append(f'NIP {company.nip}')
company.name = ' '.join(parts)
result = service.discover_for_company(company)
company.name = original_name # Restore