Skip to content

Search ignoring Polish diacritics and tolerating typos - #114

Merged
Frognar merged 1 commit into
mainfrom
claude/project-thread-myus2f
Oct 25, 2026
Merged

Frognar merged 1 commit into
mainfrom
claude/project-thread-myus2f

Conversation

@Frognar

@Frognar Frognar commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Requested by Frognar · project thread

What changes

Every text search in the database now works the same way:

  • Case and Polish diacritics are ignored: zolty ser finds Żółty ser, and NABIAL finds Nabiał.
  • Typos fall back to similar results: when no text contains the search (3+ characters), texts that are merely similar are returned instead, most similar first. For example, biedronak finds Biedronka. When something does contain the search, similar-only texts are left out, so lists don't fill up with noise.

This covers suggestions for stores, items and categories (filters and edit fields), the dictionary screen, and the receipt-line description filter.

How

  • Migration TextSearch creates the unaccent and pg_trgm extensions. Both ship with postgres:16 and are trusted. It also creates three functions in schema expense: search_key, search_contains and search_similarity.
  • TextSearch / TextMatch in Infrastructure map those functions for EF and decide containment versus similarity once per search. The similarity threshold is 0.3 word_similarity, based on sample Polish store and item names. The old ILIKE and EscapeLike code is gone.
  • New SearchApiTests run against Postgres.

Package bumps

New advisories (NU1902/NU1903) against ASP.NET Core 10.0.12 and Aspire's MessagePack made the build fail, so the Microsoft packages and dotnet-ef move to 10.0.14 and Aspire moves to 13.6.4.

Deploy

The migration runs on startup after the next manual deploy. Nothing changes in docker-compose.


Generated by Claude Code

Every search (suggestions for stores, items and categories, the dictionary
screen and the line description filter) now goes through one TextSearch
helper backed by Postgres functions on unaccent and pg_trgm: case and
diacritics are ignored, and when nothing contains the text, similar texts
are found instead, most similar first.

Also bumps ASP.NET Core / EF Core packages to 10.0.14 and Aspire to 13.6.4,
since new advisories against the old versions fail the build.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013kNEPUAfpmZDfoNDgxFMTi
@Frognar Frognar self-assigned this Oct 25, 2026
@Frognar
Frognar marked this pull request as ready for review October 25, 2026 18:16
@Frognar
Frognar merged commit f8a89fd into main Oct 25, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants