move collation to search plugin

Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
Anders Näsman
2021-03-17 09:59:12 +01:00
committed by Eric Peterson
parent 6d4919a612
commit 0057692401
4 changed files with 18 additions and 10 deletions
-2
View File
@@ -110,8 +110,6 @@ async function main() {
console.log(err);
process.exit(1);
});
// TODO: Start Search Refresh Loop Here?
}
module.hot?.accept();
-8
View File
@@ -19,10 +19,8 @@ import {
CatalogBuilder,
createRouter,
runPeriodically,
SearchCollatorFactory,
} from '@backstage/plugin-catalog-backend';
import { Router } from 'express';
import { registerCollator } from '@backstage/plugin-search-indexer-backend';
import { PluginEnvironment } from '../types';
export default async function createPlugin(
@@ -41,12 +39,6 @@ export default async function createPlugin(
runPeriodically(() => higherOrderOperation.refreshAllLocations(), 100000),
);
registerCollator({
type: 'software-catalog',
defaultRefreshIntervalSeconds: 600,
collator: SearchCollatorFactory(entitiesCatalog),
});
return await createRouter({
entitiesCatalog,
locationsCatalog,
+15
View File
@@ -14,9 +14,24 @@
* limitations under the License.
*/
import { createRouter } from '@backstage/plugin-search-backend';
import {
collateDocuments,
// registerCollator,
} from '@backstage/plugin-search-indexer-backend';
import { PluginEnvironment } from '../types';
// import { SearchCollatorFactory } from '@backstage/plugin-catalog-backend';
export default async function createPlugin({ logger }: PluginEnvironment) {
// TODO: Within this PR, update to use REST API instead of Catalog Builder.
/* registerCollator({
type: 'software-catalog',
defaultRefreshIntervalSeconds: 600,
collator: SearchCollatorFactory(entitiesCatalog),
});*/
// TODO: Make this a more proper refresh loop.
collateDocuments();
return await createRouter({
logger,
});
@@ -27,3 +27,6 @@ export const registerCollator = (params: RegisterCollatorParameters) => {
export const registerDecorator = (params: RegisterDecoratorParameters) => {
registry.addDecorator(params);
};
export const collateDocuments = () => {
registry.execute();
};