feat(search): add exact company aliases

Embed a versioned local alias overlay and rank exact aliases before legal-name matches and word prefixes. Normalize Unicode consistently, deduplicate by company identity before limiting, and update bilingual search guidance and tests.

Refs #24

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 18:08:35 +01:00
parent 64a7124889
commit f7b057efa3
13 changed files with 413 additions and 43 deletions

View File

@ -50,7 +50,7 @@ describe('Régressions Watchlist — recherche explicite et suivis d’entrepris
searchIndices.mockResolvedValueOnce([indexOne])
render(<Watchlist />)
const query = await screen.findByRole('textbox', { name: "Nom de l'entreprise" })
const query = await screen.findByRole('textbox', { name: 'Nom ou nom courant de l’entreprise' })
expect(query).toHaveAttribute('maxLength', '100')
await user.type(query, 'Apple Inc.')
expect(searchIndices).not.toHaveBeenCalled()
@ -74,9 +74,9 @@ describe('Régressions Watchlist — recherche explicite et suivis d’entrepris
const history = await screen.findByRole('region', { name: /actifs historiques/i })
expect(within(history).queryByRole('button')).not.toBeInTheDocument()
expect(within(history).getByText('Old historic asset')).toBeInTheDocument()
expect(screen.getByLabelText("Nom de l'entreprise")).toBeInTheDocument()
expect(screen.getByLabelText('Nom ou nom courant de l’entreprise')).toBeInTheDocument()
const query = screen.getByRole('textbox', { name: "Nom de l'entreprise" })
const query = screen.getByRole('textbox', { name: 'Nom ou nom courant de l’entreprise' })
await user.type(query, 'Apple Inc.{Enter}')
const results = await screen.findByRole('region', { name: /résultats des entreprises/i })
expect(within(results).getByText('Nasdaq')).toBeInTheDocument()
@ -94,7 +94,7 @@ describe('Régressions Watchlist — recherche explicite et suivis d’entrepris
it('annonce aucun résultat et les erreurs quota, timeout et indisponibilité sans effacer la recherche', async () => {
const user = userEvent.setup()
render(<Watchlist />)
const query = await screen.findByRole('textbox', { name: "Nom de l'entreprise" })
const query = await screen.findByRole('textbox', { name: 'Nom ou nom courant de l’entreprise' })
searchIndices.mockResolvedValueOnce([])
await user.type(query, 'No match{Enter}')
@ -122,7 +122,7 @@ describe('Régressions Watchlist — recherche explicite et suivis d’entrepris
.mockReturnValueOnce(new Promise(resolve => { resolveCurrent = resolve }))
const user = userEvent.setup()
render(<Watchlist />)
const query = await screen.findByRole('textbox', { name: "Nom de l'entreprise" })
const query = await screen.findByRole('textbox', { name: 'Nom ou nom courant de l’entreprise' })
await user.type(query, 'Old query{Enter}')
await user.clear(query)
@ -142,7 +142,7 @@ describe('Régressions Watchlist — recherche explicite et suivis d’entrepris
searchIndices.mockResolvedValueOnce([indexTwo])
render(<Watchlist />)
const query = await screen.findByRole('textbox', { name: "Nom de l'entreprise" })
const query = await screen.findByRole('textbox', { name: 'Nom ou nom courant de l’entreprise' })
await user.type(query, 'Apple Inc.{Enter}')
const results = await screen.findByRole('region', { name: /résultats des entreprises/i })
await user.click(within(results).getByRole('button', { name: /suivre cette entreprise/i }))