Improve ingredient search relevance for long names - #2486
Open
MikaelSiidorow wants to merge 4 commits into
Open
Conversation
MikaelSiidorow
commented
Aug 15, 2026
MikaelSiidorow
marked this pull request as draft
August 15, 2026 17:37
MikaelSiidorow
force-pushed
the
improve-ingredient-search
branch
from
August 15, 2026 19:27
9b70d1a to
3098c45
Compare
MikaelSiidorow
force-pushed
the
improve-ingredient-search
branch
from
August 15, 2026 20:06
3098c45 to
26f80bd
Compare
MikaelSiidorow
force-pushed
the
improve-ingredient-search
branch
from
August 16, 2026 10:15
4e4333f to
15fbcc2
Compare
Contributor
Author
|
Ready for another review. Since the initial draft, I have:
|
MikaelSiidorow
marked this pull request as ready for review
August 16, 2026 10:23
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.
Proposed Changes
This fixes cases where a single search term appears inside a longer ingredient name but falls below the whole-name trigram cutoff, such as
lunchnot findingLunch out (placeholder).One- and two-character searches use exact matching. Punctuation-only searches return no results without querying PostgreSQL. Multi-word searches keep the existing trigram candidate path with the improved ranking.
This PR intentionally leaves the optional exact-match toggle out of scope. That requires separate API and client-side UX decisions and can be considered as a follow-up.
Related Issue(s)
Related to #2340. This improves name-based search, but personalized ranking and catalog quality remain follow-up work.
Discussed on Discord.
Testing
Run the focused tests in the
dev-postgresenvironment:All 12 added PostgreSQL integration tests pass. The existing PostgreSQL ingredient search tests also pass.
Query plans and count-plus-top-20 latency were checked against 3,057,932 ingredient names. The indexed paths use the existing trigram GIN index, so no migration is needed. Across 12 common queries, median overhead compared with
mainwas about 5%, with higher cost for searches where the literal arm expands recall.Please check that the PR fulfills these requirements