Skip to content

Search does not ignore accents: crepes misses Crêpes #844

Open

Description

@SebastienSyd

What happens

Search treats accented letters as different letters, so a query typed without accents misses recipes whose names or text have them. With a French collection this makes search hard to use: most keyboards (and phones) make accents slow to type, and people search crepes, creme, pate rather than crêpes, crème, pâte.

Reproduce

mkdir /tmp/accents && cd /tmp/accents
printf 'Mix @farine{250%%g} and @lait{50%%cl}.\n' > 'Crêpes.cook'
printf 'Bake with @crème fraîche{20%%cl}.\n' > 'Gratin.cook'

cook search crepes          # nothing
cook search cre             # nothing (prefix of Crêpes)
cook search creme fraiche   # nothing
cook search crêpes          # Crêpes.cook

The same happens in cook server: the header search dropdown, the /search page and /api/search?q=crepes return nothing for crepes.

Expected

Matching ignores accents as it already ignores case: crepes, Crepes and crêpes all find Crêpes.cook, and an accented query still finds unaccented text.

Where it comes from

Both layers compare with to_lowercase() only:

  • cooklang-find's search_paths / score_filename_match / count_matches pick and score the candidates, so Crêpes.cook never scores above zero for crepes.
  • cookcli-core's matches_every_term (crates/core/src/search.rs) intersects those candidates and would drop it again even if the library returned it.
  • static/js/search.js (static cook build sites) does the same in the browser.

Suggested fix

Fold both sides the same way before comparing: lowercase, Unicode-decompose (NFD), drop combining marks. That also makes NFD text (macOS file names) match NFC queries. Letters without a decomposition (ø, ß, œ) are left alone. Because cookcli must not drop what the library matched, the fold should live in cooklang-find and be reused by cookcli.

I have PRs ready for both repos and will link them here.

Version: cookcli 0.41.1 (Docker image), cooklang-find 0.12.1.

Activity

  1. SebastienSyd commented on Nov 18, 2026

    @SebastienSyd
    ContributorAuthor

    Fix in two parts: cooklang/cooklang-find#41 (library: fold + export normalize_for_search), then the draft cookcli PR linked above, which will bump cooklang-find once that's released.

  2. SebastienSyd commented on Nov 18, 2026

    @SebastienSyd
    ContributorAuthor

    ex. of result with fix:

    image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions