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.
<sort-selector> reads which sort choices apply from the result it is given — a tab search and a regular
query can expose different lists, and the component resolves the right one instead of the caller having to
know which applies.
Minimal example
import { Component, signal } from "@angular/core";
import { SortSelectorComponent } from "@sinequa/atomic-angular";
import type { Result } from "@sinequa/atomic";
import type { SortingChoice } from "@sinequa/atomic-angular";
@Component({
selector: "results-toolbar",
imports: [SortSelectorComponent],
template: `
@if (result(); as r) {
<sort-selector [result]="r" (onSort)="applySort($event)" />
}
`,
})
export class ResultsToolbarComponent {
protected readonly result = signal<Result | undefined>(undefined);
protected applySort(sort: SortingChoice) {
console.log(sort.name, sort.$isDesc);
}
}How it works
- Tab search — extracts sorting choices from the specific tab's own configuration (
tab.sortingChoices), falling back to the query's if the tab defines none. - Regular query — uses the query configuration's
sortingChoicesdirectly. - Either way, a choice whose
orderByClauseincludesglobalrelevanceis filtered out when the result has no relevance score (!result().hasRelevance) — a relevance sort makes no sense without one.
Options
Prop
Type
onSort emits a SortingChoice (the configured choice plus a resolved $isDesc boolean) only when the user
picks a different option than the one currently active — reselecting the active sort emits nothing.
Pitfalls
What's next
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.
No Result
The stylized zero-match message — and where pagination for a result list actually lives, since the old Pager component is deprecated.