move collation to search plugin
Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
committed by
Eric Peterson
parent
6d4919a612
commit
0057692401
@@ -110,8 +110,6 @@ async function main() {
|
||||
console.log(err);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
// TODO: Start Search Refresh Loop Here?
|
||||
}
|
||||
|
||||
module.hot?.accept();
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user