added extension point documentation

Signed-off-by: Bond Yan <bondy@spotify.com>
This commit is contained in:
Bond Yan
2025-03-05 15:19:25 -05:00
parent 03d34525be
commit e7a3b2ed2e
+32
View File
@@ -134,6 +134,38 @@ search:
timeout: { minutes: 3 }
```
### Filtering through the catalog collator
The TechDocs collator by default filters through catalog entities where the annotation `metadata.annotations.backstage.io/techdocs-ref` exists. If you wish to further filter out entities, there are two ways to do so through the `techDocsCollatorEntityFilterExtensionPoint`.
```typescript
export const exampleCustomCatalogFiltering = createBackendModule({
pluginId: 'search',
moduleId: 'search-techdocs-collator-entity-filter',
register(reg) {
reg.registerInit({
deps: {
customCollatorFilter: techDocsCollatorEntityFilterExtensionPoint,
},
async init({ customCollatorFilter }) {
/* filtering by catalog params */
customCollatorFilter.setCustomCatalogApiFilters([
{ kind: ['API', 'Component', ...] },
{ metadata: ['...more filters'] },
]);
/* filtering by a custom function */
customCollatorFilter.setEntityFilterFunction((entities: Entity[]) =>
entities.filter(
entity => entity.metadata?.annotations?.abc === 'xyz',
),
);
},
});
},
});
```
## Community Collators
Here are some of the known Search Collators available in from the Backstage Community: