[PR #4208] [MERGED] fix(emoji): match picker search on keywords, not just Unicode names #6282

Closed
opened 2026-10-23 04:08:56 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4208
Author: @Gunterlie
Created: 7/28/2026
Status: ✅ Merged
Merged: 7/28/2026
Merged by: @SpicyMarinara

Base: staging ← Head: emoji-picker-coverage


📝 Commits (3)

  • 4e3856d feat(emoji): match search on keywords, not just Unicode names
  • 8cd02ff Merge remote-tracking branch 'origin/staging' into emoji-picker-coverage
  • fc40a9b Fix emoji search false positives by removing ambiguous synonyms

📊 Changes

4 files changed (+593 additions, -450 deletions)

View changed files

📝 packages/client/src/components/ui/EmojiPicker.tsx (+7 -446)
➕ packages/client/src/lib/emoji-search.ts (+553 -0)
📝 packages/client/src/lib/emoji-shortcodes.ts (+4 -4)
📝 scripts/regressions/emoji-catalog.regression.ts (+29 -0)

📄 Description

Linked issue

Closes #

Why this change

A user reported that emoji they could see in the picker grid could not be
found by typing: apple and star returned nothing, while 🍎 and ⭐ were
sitting right there in the list.

The cause is that search matched a plain substring against the official Unicode
name only. Those names are not what people type:

typed before why
happy nothing 😀 is grinning face
thumbsup nothing 👍 is thumbs up
celebrate nothing 🎉 is party popper
lol 🍭 only substring of lollipop, and 😂 is face with tears of joy
face grinning nothing wrong word order
tick 🥢 🎟️ 🎫 🕹️ 💄 substring of chopsticks, ticket, lipstick

The :shortcode: autocomplete had the same problem, and worse: the curated
keyword map lived inside EmojiPicker.tsx, so autocomplete had no aliases at all.

What changed

  • New packages/client/src/lib/emoji-search.ts — one search layer shared by
    the picker grid and :shortcode: autocomplete, so the two can no longer drift.
  • EMOJI_KEYWORDS — the existing 429-entry alias map, moved out of
    EmojiPicker.tsx. No content change; autocomplete now benefits from it too.
  • WORD_SYNONYMS — keyed on a word of the Unicode name rather than per
    emoji, so a single entry (laughing → lol lmao haha funny) covers every emoji
    containing that word across all 1,914. This is the part that scales: the old
    per-emoji map only ever covered curated entries and silently went stale as the
    catalog grew.
  • Per-word prefix matching — every query word must prefix-match a word of the
    emoji's search text. Word order stops mattering, and substring false hits are
    gone (tick no longer returns chopsticks).
  • scripts/regressions/emoji-catalog.regression.ts — extended the existing
    pnpm regression:emoji lane with the reporter's exact queries plus the
    false-positive guards.

Net +588 / −449 across 4 files — smaller overall, since the alias map moved
out of the component.

Results after the change

typed now returns
apple 🍎🍏
star 🤩⭐🌟🌠✨✡️☪️🔯✴️🌃
beach 🏖️⛱️🏝️🌴
travel ✈️🛩️🛫🛬🧳🛅🏖️🏝️🌴⛱️
happy / smiley 21 faces
thumbsup 👍👎
celebrate 🥳🙌🎂🎉🎊
face grinning 😀😃😄😆😅
tick ✅☑️✔️🎟️🎫 — no longer 🥢

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Agent-run, for the reviewer's information (these do not substitute for the
boxes above, which are a to-do list for the human contributor):

  • pnpm check → exit 0. The one lint warning (NoodleHome.tsx, missing
    localizeUi dep) is pre-existing and untouched here.
  • pnpm regression:emoji → passes.

Manual verification notes

Nothing below has been exercised in a real browser by the agent — the regression
lane calls the matcher directly, not the UI. Needs a human:

  • Manually verify in browser: open the emoji picker in Conversation mode and
    type each query in the results table above; confirm the listed emoji appear.
  • Manually verify in browser: type :appl, :celebrate, :thumbsup in the
    composer and confirm the :shortcode: autocomplete suggests the right emoji.
  • Manually verify in browser: confirm tick does not return 🥢, i.e. the
    false-positive fix holds in the real UI.
  • Manually verify on mobile viewport: same searches inside the mobile
    composer sheet (the picker renders embedded there).
  • Manually verify: empty query still shows the normal category grid, and a
    no-match query (e.g. zzzz) shows an empty state rather than breaking.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

No user-facing docs describe emoji search behaviour, so this likely needs no docs
change — reviewer to confirm whether it warrants a CHANGELOG.md entry.

Known limitations

  • No relevance ranking. The grid keeps catalog order, so beach lists 🌴
    before 🏖️. Ranking is a larger change and was deliberately left out.
  • English only. Synonyms are English; a non-English UI still searches
    English Unicode names.
  • Synonyms are a blunt instrument. Because they key on a name word, a careless
    entry sprays across the catalog. Four were caught and removed during
    development: eyes → staring made star match a dozen face emoji, and
    island → travel holiday made every flag: … island match travel. New
    synonym entries want a spot-check against the full catalog, not a blind add.

A note on the original report

The same report also said emoji were missing (🫂, 🏖️, ⛱️, "anything related
to travels"). That part appears to be already fixed and not addressed here:

  • The picker has used the full generated Unicode 17.0 catalog (1,914 base emoji,
    all 9 groups incl. Travel & Places) since 2f3c0a8c2, shipped in v2.2.0.
  • Before that, the grid was a hand-curated list of 629 emoji across 8 tabs with
    no Travel & Places tab at all — which matches the report exactly.
  • That older picker also had keywords for only 431 of its 629 visible emoji, and
    🍎 and ⭐ were both in the unkeyworded 198. That is precisely the "they are
    there, tho" symptom.

Reviewer: worth confirming the reporter's version before this ships as the
answer to their report.
If they are on ≥ 2.2.0 and still see missing emoji,
the diagnosis above is wrong and there is a second bug this PR does not fix.

Summary by CodeRabbit

  • New Features

    • Improved emoji search with broader keyword and synonym matching.
    • Added support for nickname-style searches, reordered search terms, and pasted emoji characters.
    • Enhanced emoji labels and tooltips with more descriptive searchable names.
  • Bug Fixes

    • Reduced incorrect emoji matches, including empty queries and unrelated terms.
  • Tests

    • Expanded coverage for emoji search behavior and matching accuracy.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/4208 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 7/28/2026 **Status:** ✅ Merged **Merged:** 7/28/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `emoji-picker-coverage` --- ### 📝 Commits (3) - [`4e3856d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4e3856dc52320de8e89880cc58921f59c23a01eb) feat(emoji): match search on keywords, not just Unicode names - [`8cd02ff`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8cd02ffaede754beab6a08cab808305faac895d4) Merge remote-tracking branch 'origin/staging' into emoji-picker-coverage - [`fc40a9b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fc40a9b35dabb4ee91e684431e454032c4740465) Fix emoji search false positives by removing ambiguous synonyms ### 📊 Changes **4 files changed** (+593 additions, -450 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/ui/EmojiPicker.tsx` (+7 -446) ➕ `packages/client/src/lib/emoji-search.ts` (+553 -0) 📝 `packages/client/src/lib/emoji-shortcodes.ts` (+4 -4) 📝 `scripts/regressions/emoji-catalog.regression.ts` (+29 -0) </details> ### 📄 Description ## Linked issue Closes # <!-- ⚠️ No issue is linked yet — one should be opened before this leaves draft. See "A note on the original report" below: the reporter's *missing emoji* complaint appears to already be fixed, so the issue should be scoped to the search behaviour only. --> ## Why this change A user reported that emoji they could **see in the picker grid** could not be found by typing: `apple` and `star` returned nothing, while 🍎 and ⭐ were sitting right there in the list. The cause is that search matched a plain substring against the official Unicode name only. Those names are not what people type: | typed | before | why | | --- | --- | --- | | `happy` | nothing | 😀 is `grinning face` | | `thumbsup` | nothing | 👍 is `thumbs up` | | `celebrate` | nothing | 🎉 is `party popper` | | `lol` | 🍭 only | substring of `lollipop`, and 😂 is `face with tears of joy` | | `face grinning` | nothing | wrong word order | | `tick` | 🥢 🎟️ 🎫 🕹️ 💄 | substring of `chopsticks`, `ticket`, `lipstick` | The `:shortcode:` autocomplete had the same problem, and worse: the curated keyword map lived inside `EmojiPicker.tsx`, so autocomplete had no aliases at all. ## What changed - **New `packages/client/src/lib/emoji-search.ts`** — one search layer shared by the picker grid and `:shortcode:` autocomplete, so the two can no longer drift. - **`EMOJI_KEYWORDS`** — the existing 429-entry alias map, moved out of `EmojiPicker.tsx`. No content change; autocomplete now benefits from it too. - **`WORD_SYNONYMS`** — keyed on a *word of the Unicode name* rather than per emoji, so a single entry (`laughing → lol lmao haha funny`) covers every emoji containing that word across all 1,914. This is the part that scales: the old per-emoji map only ever covered curated entries and silently went stale as the catalog grew. - **Per-word prefix matching** — every query word must prefix-match a word of the emoji's search text. Word order stops mattering, and substring false hits are gone (`tick` no longer returns chopsticks). - **`scripts/regressions/emoji-catalog.regression.ts`** — extended the existing `pnpm regression:emoji` lane with the reporter's exact queries plus the false-positive guards. Net **+588 / −449** across 4 files — smaller overall, since the alias map moved out of the component. ### Results after the change | typed | now returns | | --- | --- | | `apple` | 🍎🍏 | | `star` | 🤩⭐🌟🌠✨✡️☪️🔯✴️🌃 | | `beach` | 🏖️⛱️🏝️🌴 | | `travel` | ✈️🛩️🛫🛬🧳🛅🏖️🏝️🌴⛱️ | | `happy` / `smiley` | 21 faces | | `thumbsup` | 👍👎 | | `celebrate` | 🥳🙌🎂🎉🎊 | | `face grinning` | 😀😃😄😆😅 | | `tick` | ✅☑️✔️🎟️🎫 — no longer 🥢 | ## Validation - [x] `pnpm check` passes locally - [x] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` Agent-run, for the reviewer's information (these do **not** substitute for the boxes above, which are a to-do list for the human contributor): - `pnpm check` → exit 0. The one lint warning (`NoodleHome.tsx`, missing `localizeUi` dep) is pre-existing and untouched here. - `pnpm regression:emoji` → passes. ### Manual verification notes Nothing below has been exercised in a real browser by the agent — the regression lane calls the matcher directly, not the UI. Needs a human: - **Manually verify in browser:** open the emoji picker in Conversation mode and type each query in the results table above; confirm the listed emoji appear. - **Manually verify in browser:** type `:appl`, `:celebrate`, `:thumbsup` in the composer and confirm the `:shortcode:` autocomplete suggests the right emoji. - **Manually verify in browser:** confirm `tick` does *not* return 🥢, i.e. the false-positive fix holds in the real UI. - **Manually verify on mobile viewport:** same searches inside the mobile composer sheet (the picker renders `embedded` there). - **Manually verify:** empty query still shows the normal category grid, and a no-match query (e.g. `zzzz`) shows an empty state rather than breaking. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) No user-facing docs describe emoji search behaviour, so this likely needs no docs change — reviewer to confirm whether it warrants a `CHANGELOG.md` entry. ## Known limitations - **No relevance ranking.** The grid keeps catalog order, so `beach` lists 🌴 before 🏖️. Ranking is a larger change and was deliberately left out. - **English only.** Synonyms are English; a non-English UI still searches English Unicode names. - **Synonyms are a blunt instrument.** Because they key on a name word, a careless entry sprays across the catalog. Four were caught and removed during development: `eyes → staring` made `star` match a dozen face emoji, and `island → travel holiday` made every `flag: … island` match `travel`. New synonym entries want a spot-check against the full catalog, not a blind add. ## A note on the original report The same report also said emoji were **missing** (🫂, 🏖️, ⛱️, "anything related to travels"). That part appears to be **already fixed and not addressed here**: - The picker has used the full generated Unicode 17.0 catalog (1,914 base emoji, all 9 groups incl. Travel & Places) since `2f3c0a8c2`, shipped in **v2.2.0**. - Before that, the grid was a hand-curated list of 629 emoji across 8 tabs with **no Travel & Places tab at all** — which matches the report exactly. - That older picker also had keywords for only 431 of its 629 visible emoji, and 🍎 and ⭐ were both in the unkeyworded 198. That is precisely the "they *are* there, tho" symptom. **Reviewer: worth confirming the reporter's version before this ships as the answer to their report.** If they are on ≥ 2.2.0 and still see missing emoji, the diagnosis above is wrong and there is a second bug this PR does not fix. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Improved emoji search with broader keyword and synonym matching. - Added support for nickname-style searches, reordered search terms, and pasted emoji characters. - Enhanced emoji labels and tooltips with more descriptive searchable names. - **Bug Fixes** - Reduced incorrect emoji matches, including empty queries and unrelated terms. - **Tests** - Expanded coverage for emoji search behavior and matching accuracy. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:08:56 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#6282
No description provided.