Did You Mean
Turn a result's spelling correction into the right message — the engine corrected the query, expanded it, or only suggests a correction — and let the user switch between the two spellings.
When the engine corrects a misspelled query, three different things could actually have happened to the
search: the corrected term fully replaced the original, both spellings were searched together, or nothing was
searched yet and the engine only proposes a correction. <did-you-mean> reads which one from the result and
renders the matching message, with links to switch spellings.
Concept — applied changes
Since engine 11.14, a corrected result reports didYouMean.text.appliedChanges — one entry per corrected term,
each naming the actual action the engine took (correction, expansion, or suggestion). Before 11.14 that
field does not exist, and the component falls back to inferring the action from spellingCorrectionMode.
Minimal example
import { Component, signal } from "@angular/core";
import { DidYouMeanComponent } from "@sinequa/atomic-angular";
import type { Result } from "@sinequa/atomic";
@Component({
selector: "results-component",
imports: [DidYouMeanComponent],
template: `
@if (result(); as r) {
<did-you-mean [result]="r" />
}
`,
})
export class ResultsComponent {
protected readonly result = signal<Result | undefined>(undefined);
}How it works
Which message renders depends entirely on the resolved action — a computed the component derives from the
result, never set directly:
A mixed result — some terms corrected, others expanded — deliberately falls back to suggestion: it is the
only one of the three messages that does not assert a specific search behavior that may not actually have
happened for every term.
The three messages
| Action | Meaning | Message |
|---|---|---|
correction | The original term was replaced | Showing results for Catalon. Search instead for katalon |
expansion | Both spellings were searched together | Showing results for katalon and Catalon |
suggestion | Only the original was searched | Did you mean Catalon? |
Options
Prop
Type
selectCorrected() and selectOriginal() are the two methods every message's links call — both patch
QueryParamsStore with spellingCorrectionMode: "dymonly" and navigate with the chosen text, so the engine
does not re-correct the choice the user just made.
Pitfalls
What's next
Autocomplete
Suggestions as the user types — from configured suggest queries on the server, and from the user's own recent/saved searches and bookmarks.
Sort Selector
A dropdown listing the sort choices a tab or query configuration actually offers, resolved from the current result rather than passed in by hand.