Saliem Talash: When search misses a title you can see

A reader sees a title in a list, types its opening word into search and gets no results. Before changing the title or adding another empty-state message, keep the exact stored text and query. Two strings can look alike while containing different character sequences.

For a small website with a title filter, the useful question is specific: which differences should the matching rule ignore, and which should it preserve? A reproducible example makes that decision easier to review than a general instruction to make search more forgiving.

Start with one title and one query

The fictional title in this example is “Café opening notes.” Its stored accent uses an ordinary letter e followed by a combining acute accent. The query uses a single precomposed é. A local JavaScript comparison on November 5, 2026 found that the two opening words were unequal before normalization and equal after both were normalized to NFC.

This short example exposes the difference without relying on a font to make it visible:

const stored =
  "Cafe\u0301 opening notes";
const query = "Caf\u00e9";

const raw =
  stored.includes(query);
const nfc =
  stored.normalize("NFC");
const found = nfc.includes(
  query.normalize("NFC")
);
// raw: false
// found: true

The escape sequences specify the exact characters. They are part of the JavaScript example; a reader should not type the backslash sequence into a normal search box. In the stored opening word, U+0065 and U+0301 form the accented letter. The query instead contains U+00E9.

MDN documents NFC as a Unicode normalization form that can give canonically equivalent sequences a common representation. Its includes() documentation also matters here: that operation performs a case-sensitive substring search. These are separate parts of the example's matching rule.

AI assistance was used to prepare the fictional records, execute the comparison and draft this article. The results below come from Node 26.11.1 with ICU 78.3 and Unicode 17.0. They are local string comparisons, not tests of a live website, browser Find, Google Search or reader behaviour.

Keep a control that normalization does not fix

A second record is “Owner’s notes,” containing a curly apostrophe. The query is “Owner's,” using a straight apostrophe. Neither NFC nor the separately tested NFKC form produced a match in this fixture.

That control prevents an overclaim. Fixing the accent example does not establish that punctuation variants, letter case, missing accents or every visually similar character now behave as a reader expects. Each needs an explicit decision and an example of its own.

Two more fictional titles expose a different boundary. “Site brief” contains a non-breaking space in the stored record, while its query has an ordinary space. “Office files” stores the letters fi in “files” as the single fi ligature character, while its query uses separate f and i characters.

For this comparison, every query searched the same four records. The code applied the selected normalization form to both the stored title and the query before calling includes(). It did not trim spaces, change case, replace punctuation or remove accents.

Read the five query results separately

The complete local results were:

  • Café: no raw match; R01 after NFC; R01 after NFKC.
  • Owner's: no match under any of the three rules.
  • Site brief: no raw or NFC match; R03 after NFKC.
  • Office files: no raw or NFC match; R04 after NFKC.
  • invoice: no match under any rule. No fixture record contains that word.

A separate uppercase query, “CAFÉ,” also returned no match with NFC. The comparison was still case-sensitive. That result should remain in the review record rather than disappearing behind a successful accent example.

The two NFKC-only matches show why the choice of normalization form belongs in the specification. Unicode distinguishes canonical equivalence from compatibility equivalence. Its normalization annex cautions that compatibility forms can remove distinctions that matter in some contexts. These four records do not establish a universal policy for other languages, specialist notation or identifiers.

Separate the displayed title from its comparison value

For a proposed title filter, keep the authored title available for display. Derive a comparison value according to the chosen search policy instead of silently replacing the title everywhere with the transformed text.

In this fixture, calling normalize() for comparison left the original record unchanged. That observation covers the saved strings in this local example. A real implementation still needs review of its storage, indexing and rendering paths.

This separation also makes a useful review question possible: can a matching result display the same title the editor approved? If a compatibility transformation joins two representations for search, that does not by itself authorize changing the displayed wording, an exported value or a permanent address.

Highlighting needs separate attention. A transformed comparison string can have a different length from its source. Do not assume that an offset found in it identifies the same character range in the displayed title. This example did not implement or test highlighting.

Write the matching policy before widening it

A small acceptance note can name the field, comparison rule, query and expected record. For the first fictional record it would read: title field; case-sensitive NFC substring comparison on both inputs; query Café; expected result R01; original display title retained.

Add an explicit decision for the curly-apostrophe control. If the product should treat straight and curly apostrophes alike in this field, describe that additional transformation and test it. Do not report it as behaviour already supplied by NFC.

Do the same for case and spacing. A decision to tolerate an ordinary space in place of a non-breaking space is narrower than a decision to remove every separator. Review the actual examples before adopting a broader rule. Keep a genuinely absent query so that a result is not accepted merely because every input produces something.

This is a review method for a small text filter, not a production search engine implementation. Ranking, tokenization, stemming, language-sensitive matching, fuzzy matching, permissions and result highlighting were outside the experiment.

Keep a small record that survives the fix

Save the original title, the exact query, the chosen transformation and the expected record identifier. Add the observed result and environment. For characters that are hard to distinguish visually, retain their code points or an escaped version alongside the readable text.

After a change, rerun the original accent case and the controls. Check the result identity, the unchanged displayed title and the absent query. A successful first example is useful evidence; the controls define how far that evidence extends.

The goal is an understandable matching rule that another reviewer can reproduce. The title itself should not have to be rewritten merely to conceal an unexplained comparison failure.

Sources and author

Saliem Talash is a Toronto-based founder. His STEO journal covers building, design and the web. Read the journal's editorial approach or explore his selected work. This article uses fictional records and makes no claim about a customer system or measured audience demand.

Comments

Popular posts from this blog

Saliem Talash: Why I made a website project workbook that works offline

Saliem Talash: all official pages, videos and profiles

Saliem Talash: A worked website handoff for a fictional flower shop