Change variable name to documentType

Signed-off-by: Kacper Nowacki <kacper.nowacki@dynatrace.com>
This commit is contained in:
Kacper Nowacki
2023-03-01 14:14:31 +01:00
parent 35b5587118
commit 5a2df6c0c8
4 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -2,4 +2,4 @@
'@backstage/plugin-catalog-backend': patch
---
Added optional parameter `type` to `DefaultCatalogCollatorFactoryOptions` which allows to override default document type `software-catalog`. For more details, see [How to customize document type in the Software Catalog index](../docs/features/search/how-to-guides.md#how-to-customize-document-type-in-the-software-catalog-index).
Added optional parameter `documentType` to `DefaultCatalogCollatorFactoryOptions` which allows to override default document type `software-catalog`. For more details, see [How to customize document type in the Software Catalog index](../docs/features/search/how-to-guides.md#how-to-customize-document-type-in-the-software-catalog-index).
+3 -3
View File
@@ -189,7 +189,7 @@ entities are indexed by the search engine.
In some cases you might want to have the ability to change the document type in which catalog entities will be indexed by catalog collator.
Such option gives a possibility to customize SearchPage results and filters depending on which document type you would like to see results for.
You can achieve that by passing additional parameter `type` to the `DefaultCatalogCollatorFactory`.
You can achieve that by passing additional parameter `documentType` to the `DefaultCatalogCollatorFactory`.
Let's say that you want to have two different document types for some entities.
Our example will cover a use case in which we want to:
@@ -197,7 +197,7 @@ Our example will cover a use case in which we want to:
- Store entities of kind `User` or `Group` under document type `yourCustomDocumentType`,
- Store rest of entities under default document type `software-catalog`
To achieve that you will have to remove `User` and `Group` from your previous collator `filter` and register new `DefaultCatalogCollatorFactory` with new parameter `type`.
To achieve that you will have to remove `User` and `Group` from your previous collator `filter` and register new `DefaultCatalogCollatorFactory` with new parameter `documentType`.
```diff
// packages/backend/src/plugins/search.ts
@@ -222,7 +222,7 @@ To achieve that you will have to remove `User` and `Group` from your previous co
+ filter: {
+ kind: ['User', 'Group'],
+ },
+ type: 'yourCustomDocumentType',
+ documentType: 'yourCustomDocumentType',
+ }),
+ });
```
+1 -1
View File
@@ -382,7 +382,7 @@ export type DefaultCatalogCollatorFactoryOptions = {
batchSize?: number;
catalogClient?: CatalogApi;
entityTransformer?: CatalogCollatorEntityTransformer;
type?: string;
documentType?: string;
};
export { DeferredEntity };
@@ -44,7 +44,7 @@ export type DefaultCatalogCollatorFactoryOptions = {
batchSize?: number;
catalogClient?: CatalogApi;
entityTransformer?: CatalogCollatorEntityTransformer;
type?: string;
documentType?: string;
};
/** @public */
@@ -76,7 +76,7 @@ export class DefaultCatalogCollatorFactory implements DocumentCollatorFactory {
catalogClient,
tokenManager,
entityTransformer,
type,
documentType,
} = options;
this.locationTemplate =
@@ -88,7 +88,7 @@ export class DefaultCatalogCollatorFactory implements DocumentCollatorFactory {
this.tokenManager = tokenManager;
this.entityTransformer =
entityTransformer ?? defaultCatalogCollatorEntityTransformer;
this.type = type ?? 'software-catalog';
this.type = documentType ?? 'software-catalog';
}
async getCollator(): Promise<Readable> {