Skip to content

Commit 42778c6

Browse files
committed
chore: introduce setupIndexes search method that ensure indexes and add update filterable attributes
1 parent a131b12 commit 42778c6

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

api/src/app/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ useContainer(Container); // eslint-disable-line react-hooks/rules-of-hooks
4141

4242
// Initialize Search Service
4343
const searchService = Container.get(SearchService);
44-
await searchService.ensureIndexes();
44+
await searchService.setupIndexes();
4545

4646
// Add crons to DI container
4747
const CronServices = [DigestCron];

api/src/search/service.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,12 @@ export class SearchService {
5757
});
5858
};
5959

60-
public ensureIndexes = async (): Promise<void> => {
60+
public setupIndexes = async (): Promise<void> => {
61+
await this.ensureIndexes();
62+
await this.updateFilterableAttributes();
63+
};
64+
65+
private ensureIndexes = async (): Promise<void> => {
6166
await this.meilisearch.createIndex("project", {
6267
primaryKey: "id",
6368
});
@@ -72,8 +77,6 @@ export class SearchService {
7277
primaryKey: "id",
7378
});
7479
this.logger.info({ message: "contributor index created" });
75-
76-
await this.updateFilterableAttributes();
7780
};
7881

7982
private async updateFilterableAttributes(): Promise<void> {

0 commit comments

Comments
 (0)