Skip to content

Commit

Permalink
nits on doc
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed Jun 4, 2020
1 parent 979b113 commit 3a89d29
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
12 changes: 7 additions & 5 deletions x-pack/plugins/global_search/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/global_search/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions x-pack/plugins/global_search/public/services/search_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions x-pack/plugins/global_search/server/services/search_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3a89d29

Please sign in to comment.