VONQ
ChangelogVersion 4.8

Sort Search Job Title results with sortBy

Sort Search Job Title results with sortBy

window.hapi.service.product.getJobTitles(text, sortBy?) now accepts an optional second argument to control the order of the results returned by the Search Job Title endpoint.

Sort options

sortBy accepts a value from the new JobTitleSortBy enum (exported from @vonq/hapi-elements-types):

ValueConstantOrder
relevanceJobTitleSortBy.relevanceSearch relevance (default)
frequency.descJobTitleSortBy.frequencyHighToLowMost frequently used titles first
frequency.ascJobTitleSortBy.frequencyLowToHighLeast frequently used titles first
name.ascJobTitleSortBy.nameAscLocalized name, A to Z
name.descJobTitleSortBy.nameDescLocalized name, Z to A
import { JobTitleSortBy } from "@vonq/hapi-elements-types"

// Alphabetical by localized name
await window.hapi.service.product.getJobTitles(
  "developer",
  JobTitleSortBy.nameAsc,
)

The valid values are also available at runtime via window.hapi.utils.product.jobTitleSortByKeys.

Job-title filter widget

A Sort by control for the job-title filter widget is being rolled out and is not yet enabled by default, so the widget behaves exactly as before for now. When enabled, it appears next to the job title field so it's clear the control affects that search: end users can choose the order of the suggested titles (Relevance — the default — Name A–Z / Z–A, or Most / Least used), the chosen order is applied to the autocomplete suggestions, the selection is remembered while navigating between steps, and the two fields stack on narrow screens. You don't need to wait for the in-widget control — the getJobTitles(text, sortBy) SDK call shown above applies a sort order today.

Name sorting and language

name.asc and name.desc sort by the title name in the language resolved from the current locale (the language Elements already sends with each request), falling back to the default language. You don't need to do anything extra — set the locale as usual and the name order follows it.

Backwards compatibility

  • sortBy is optional. Calling getJobTitles(text) with no second argument behaves exactly as before (relevance-ranked results).
  • The in-widget Sort by control is not enabled by default, so the job-title field is unchanged.
  • No SDK function, getter, setter, property, or event was removed or renamed.
  • No translation keys were removed.

I18n

The following i18n translations have been added (used by the Sort by dropdown in the job-title filter widget):

Key"en" value"de" value"nl" value"fr" value"es" value"it" value
products.filters.job-title-sort-by-labelSort bySortieren nachSorteren opTrier parOrdenar porOrdina per
products.filters.job-title-sort-by-descriptionChoose the order of the suggested job titlesWählen Sie die Reihenfolge der vorgeschlagenen JobtitelKies de volgorde van de voorgestelde functietitelsChoisissez l'ordre des intitulés de poste suggérésElige el orden de los puestos sugeridosScegli l'ordine dei titoli di lavoro suggeriti
products.job-title-sort-by.relevanceRelevanceRelevanzRelevantiePertinenceRelevanciaRilevanza
products.job-title-sort-by.name-ascName (A–Z)Name (A–Z)Naam (A–Z)Nom (A–Z)Nombre (A–Z)Nome (A–Z)
products.job-title-sort-by.name-descName (Z–A)Name (Z–A)Naam (Z–A)Nom (Z–A)Nombre (Z–A)Nome (Z–A)
products.job-title-sort-by.frequency-high-to-lowMost usedAm häufigsten verwendetMeest gebruiktLes plus utilisésMás utilizadosPiù utilizzati
products.job-title-sort-by.frequency-low-to-highLeast usedAm wenigsten verwendetMinst gebruiktLes moins utilisésMenos utilizadosMeno utilizzati