From 3a89d2901fbf8e19629143c2bbdebd807ffec4d7 Mon Sep 17 00:00:00 2001 From: pgayvallet Date: Thu, 4 Jun 2020 14:17:47 +0200 Subject: [PATCH] nits on doc --- x-pack/plugins/global_search/README.md | 12 +++++++----- x-pack/plugins/global_search/common/utils.ts | 2 +- .../global_search/public/services/search_service.ts | 10 +++++----- .../global_search/server/services/search_service.ts | 12 ++++++------ 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/x-pack/plugins/global_search/README.md b/x-pack/plugins/global_search/README.md index 4d7a22bd7d3e..d47e0bd696fd 100644 --- a/x-pack/plugins/global_search/README.md +++ b/x-pack/plugins/global_search/README.md @@ -6,15 +6,15 @@ or dashboards from the Kibana instance, from both server and client-side plugins ## Consuming the globalSearch API ```ts -startDeps.globalSearch.find('some term').subscribe( - ({ results }) => { +startDeps.globalSearch.find('some term').subscribe({ + next: ({ results }) => { addNewResultsToList(results); }, - () => {}, - () => { + error: () => {}, + complete: () => { showAsyncSearchIndicator(false); } -); +}); ``` ## Registering custom result providers @@ -39,6 +39,8 @@ Results from providers registered from the client-side `registerResultProvider` not be available when performing a search from the server-side. For this reason, prefer registering providers using the server-side API when possible. +Refer to the [RFC](rfcs/text/0011_global_search.md#result_provider_registration) for more details + ### Search completion cause There is currently no way to identify `globalSearch.find` observable completion cause: diff --git a/x-pack/plugins/global_search/common/utils.ts b/x-pack/plugins/global_search/common/utils.ts index bc4bce751939..46648319458d 100644 --- a/x-pack/plugins/global_search/common/utils.ts +++ b/x-pack/plugins/global_search/common/utils.ts @@ -22,7 +22,7 @@ export const convertResultUrl = ( ): string => { if (typeof url === 'string') { // relative path - if (url.indexOf('/') === 0) { + if (url.startsWith('/')) { return basePath.prepend(url); } // absolute url diff --git a/x-pack/plugins/global_search/public/services/search_service.ts b/x-pack/plugins/global_search/public/services/search_service.ts index ba55a807e2cf..68970b75ad97 100644 --- a/x-pack/plugins/global_search/public/services/search_service.ts +++ b/x-pack/plugins/global_search/public/services/search_service.ts @@ -51,15 +51,15 @@ export interface SearchServiceStart { * * @example * ```ts - * startDeps.globalSearch.find('some term').subscribe( - * ({ results }) => { + * startDeps.globalSearch.find('some term').subscribe({ + * next: ({ results }) => { * addNewResultsToList(results); * }, - * () => {}, - * () => { + * error: () => {}, + * complete: () => { * showAsyncSearchIndicator(false); * } - * ); + * }); * ``` * * @remarks diff --git a/x-pack/plugins/global_search/server/services/search_service.ts b/x-pack/plugins/global_search/server/services/search_service.ts index 758484e18a88..12eada2a1385 100644 --- a/x-pack/plugins/global_search/server/services/search_service.ts +++ b/x-pack/plugins/global_search/server/services/search_service.ts @@ -44,15 +44,15 @@ export interface SearchServiceStart { * * @example * ```ts - * startDeps.globalSearch.find('some term').subscribe( - * ({ results }) => { + * startDeps.globalSearch.find('some term').subscribe({ + * next: ({ results }) => { * addNewResultsToList(results); - * }, - * () => {}, - * () => { + * }, + * error: () => {}, + * complete: () => { * showAsyncSearchIndicator(false); * } - * ); + * }); * ``` * * @remarks