Repository navigation
Search ignoring Polish diacritics and tolerating typos - #114
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Frognar · project thread
What changes
Every text search in the database now works the same way:
zolty serfindsŻółty ser, andNABIALfindsNabiał.biedronakfindsBiedronka. 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
TextSearchcreates theunaccentandpg_trgmextensions. Both ship withpostgres:16and are trusted. It also creates three functions in schemaexpense:search_key,search_containsandsearch_similarity.TextSearch/TextMatchin Infrastructure map those functions for EF and decide containment versus similarity once per search. The similarity threshold is 0.3word_similarity, based on sample Polish store and item names. The oldILIKEandEscapeLikecode is gone.SearchApiTestsrun 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