Skip to content

[Search] Expose same API on client/server #55583

@lukasolson

Description

@lukasolson

Currently, the search service exposes a similar API on the client (via registerMountContext) and on the server (via registerRouteHandlerContext).

However, the service registered on each of these varies in an important way, which is that the logic and parameters that are added to the request by the client-side search strategies (when calling search client-side via mount context) will not be added when calling search server-side via route context.

Specifically, the following client-side logic which sets preference will not properly be added when using the server-side APIs:

if (typeof request.params.preference === 'undefined') {
const setPreference = context.core.uiSettings.get('courier:setRequestPreference');
const customPreference = context.core.uiSettings.get('courier:customRequestPreference');
request.params.preference = getEsPreference(setPreference, customPreference);
}

We need to move this logic into the server-side search strategy so that the APIs exposed in both places will function equivalently.

This is prerequisite to allow expressions to run server side (#46906) since esaggs will rely on the search service.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions