From 9d667467374a808c289b72ff082ed73d973b696a Mon Sep 17 00:00:00 2001 From: Camila Belo Date: Mon, 20 Mar 2023 13:16:34 +0100 Subject: [PATCH] Update readme files and api reports Co-authored-by: Emma Indal Signed-off-by: Camila Belo --- .changeset/tall-chairs-explain.md | 2 +- .changeset/wet-lamps-happen.md | 2 +- docs/features/search/how-to-guides.md | 2 +- .../search-backend-module-catalog/README.md | 18 ++++++++++++++++-- .../search-backend-module-explore/README.md | 18 ++++++++++++++++-- .../search-backend-module-techdocs/README.md | 18 ++++++++++++++++-- .../search-backend-node/alpha-api-report.md | 16 ++-------------- plugins/search-backend-node/src/alpha.ts | 10 +--------- 8 files changed, 54 insertions(+), 32 deletions(-) diff --git a/.changeset/tall-chairs-explain.md b/.changeset/tall-chairs-explain.md index e7367d2d4a..9709f225b4 100644 --- a/.changeset/tall-chairs-explain.md +++ b/.changeset/tall-chairs-explain.md @@ -4,4 +4,4 @@ '@backstage/plugin-explore-backend': patch --- -Deprecate the collator files in the backend package by extracting them into a separate module. +Collator factories instantiated in new backend system modules and now marked as deprecated. Will be continued to be exported publicly until the new backend system is fully rolled out. diff --git a/.changeset/wet-lamps-happen.md b/.changeset/wet-lamps-happen.md index 76e36d219d..066b34b23c 100644 --- a/.changeset/wet-lamps-happen.md +++ b/.changeset/wet-lamps-happen.md @@ -4,4 +4,4 @@ '@backstage/plugin-search-backend-module-explore': minor --- -Extend the index with custom collators by creating search plugin modules. +Package introduced to export search backend modules that can be used with the new backend system to extend search with plugin specific functionality, such as collators. For documentation on how to migrate, check out the [how to migrate to the new backend system guide](../docs/features/search/how-to-guides.md#how-to-migrate-to-use-search-together-with-the-new-backend-system). diff --git a/docs/features/search/how-to-guides.md b/docs/features/search/how-to-guides.md index 161ff6844c..abb29ab4eb 100644 --- a/docs/features/search/how-to-guides.md +++ b/docs/features/search/how-to-guides.md @@ -370,7 +370,7 @@ export const SearchModal = ({ toggleModal }: { toggleModal: () => void }) => ( There are other more specific search results layout components that also accept result item extensions, check their documentation: [SearchResultList](https://backstage.io/storybook/?path=/story/plugins-search-searchresultlist--with-result-item-extensions) and [SearchResultGroup](https://backstage.io/storybook/?path=/story/plugins-search-searchresultgroup--with-result-item-extensions). -## How to migrate to use Search together with the new backend system +## How to migrate your backend installation to use Search together with the new backend system > DISCLAIMER: The new backend system is in alpha, and so are the search backend support for the new backend system. We don't recommend you to migrate your backend installations to the new system yet. But if you want to experiment, this is the guide for you! diff --git a/plugins/search-backend-module-catalog/README.md b/plugins/search-backend-module-catalog/README.md index b6c734d893..b5960e2789 100644 --- a/plugins/search-backend-module-catalog/README.md +++ b/plugins/search-backend-module-catalog/README.md @@ -6,6 +6,22 @@ This package exports catalog backend modules responsible for extending search. ## Example +### Use default schedule + +```tsx +// packages/backend-next/src/index.ts +import { createBackend } from '@backstage/backend-defaults'; +import { searchPlugin } from '@backstage/plugin-search-backend/alpha'; +import { searchModuleCatalogCollator } from '@backstage/plugin-search-backend-module-catalog/alpha'; + +const backend = createBackend(); +backend.add(searchPlugin()); +backend.add(searchModuleCatalogCollator()); +backend.start(); +``` + +### Use custom schedule + ```tsx // packages/backend-next/src/index.ts import { createBackend } from '@backstage/backend-defaults'; @@ -23,5 +39,3 @@ backend.add(searchPlugin()); backend.add(searchModuleCatalogCollator({ schedule })); backend.start(); ``` - -... diff --git a/plugins/search-backend-module-explore/README.md b/plugins/search-backend-module-explore/README.md index d2b00767e2..a87f2d78f9 100644 --- a/plugins/search-backend-module-explore/README.md +++ b/plugins/search-backend-module-explore/README.md @@ -6,6 +6,22 @@ This package exports explore backend modules responsible for extending search. ## Example +### Use default schedule + +```tsx +// packages/backend-next/src/index.ts +import { createBackend } from '@backstage/backend-defaults'; +import { searchPlugin } from '@backstage/plugin-search-backend/alpha'; +import { searchModuleExploreCollator } from '@backstage/plugin-search-backend-module-explore/alpha'; + +const backend = createBackend(); +backend.add(searchPlugin()); +backend.add(searchModuleExploreCollator()); +backend.start(); +``` + +### Use custom schedule + ```tsx // packages/backend-next/src/index.ts import { createBackend } from '@backstage/backend-defaults'; @@ -23,5 +39,3 @@ backend.add(searchPlugin()); backend.add(searchModuleExploreCollator({ schedule })); backend.start(); ``` - -... diff --git a/plugins/search-backend-module-techdocs/README.md b/plugins/search-backend-module-techdocs/README.md index 817bb40998..5de310466b 100644 --- a/plugins/search-backend-module-techdocs/README.md +++ b/plugins/search-backend-module-techdocs/README.md @@ -6,6 +6,22 @@ This package exports techdocs backend modules responsible for extending search. ## Example +### Use default schedule + +```tsx +// packages/backend-next/src/index.ts +import { createBackend } from '@backstage/backend-defaults'; +import { searchPlugin } from '@backstage/plugin-search-backend/alpha'; +import { searchModuleTechDocsCollator } from '@backstage/plugin-search-backend-module-techdocs/alpha'; + +const backend = createBackend(); +backend.add(searchPlugin()); +backend.add(searchModuleTechDocsCollator()); +backend.start(); +``` + +### Use custom schedule + ```tsx // packages/backend-next/src/index.ts import { createBackend } from '@backstage/backend-defaults'; @@ -23,5 +39,3 @@ backend.add(searchPlugin()); backend.add(searchModuleTechDocsCollator({ schedule })); backend.start(); ``` - -... diff --git a/plugins/search-backend-node/alpha-api-report.md b/plugins/search-backend-node/alpha-api-report.md index 9dd754267d..74b7a4b4bc 100644 --- a/plugins/search-backend-node/alpha-api-report.md +++ b/plugins/search-backend-node/alpha-api-report.md @@ -3,24 +3,12 @@ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts -import { DocumentCollatorFactory } from '@backstage/plugin-search-common'; -import { DocumentDecoratorFactory } from '@backstage/plugin-search-common'; import { DocumentTypeInfo } from '@backstage/plugin-search-common'; import { ExtensionPoint } from '@backstage/backend-plugin-api'; +import { RegisterCollatorParameters } from '@backstage/plugin-search-backend-node'; +import { RegisterDecoratorParameters } from '@backstage/plugin-search-backend-node'; import { SearchEngine } from '@backstage/plugin-search-common'; import { ServiceRef } from '@backstage/backend-plugin-api'; -import { TaskRunner } from '@backstage/backend-tasks'; - -// @public -export interface RegisterCollatorParameters { - factory: DocumentCollatorFactory; - schedule: TaskRunner; -} - -// @public -export interface RegisterDecoratorParameters { - factory: DocumentDecoratorFactory; -} // @alpha export interface SearchEngineRegistryExtensionPoint { diff --git a/plugins/search-backend-node/src/alpha.ts b/plugins/search-backend-node/src/alpha.ts index 1565b6002d..943e11b580 100644 --- a/plugins/search-backend-node/src/alpha.ts +++ b/plugins/search-backend-node/src/alpha.ts @@ -31,7 +31,7 @@ import { createExtensionPoint } from '@backstage/backend-plugin-api'; import { RegisterCollatorParameters, RegisterDecoratorParameters, -} from './types'; +} from '@backstage/plugin-search-backend-node'; import { IndexBuilder } from './IndexBuilder'; @@ -157,11 +157,3 @@ export const searchIndexRegistryExtensionPoint = createExtensionPoint({ id: 'search.index.registry', }); - -/** - * @alpha - */ -export type { - RegisterCollatorParameters, - RegisterDecoratorParameters, -} from './types';