diff --git a/config/default.yaml b/config/default.yaml index 1170276..3693dbc 100644 --- a/config/default.yaml +++ b/config/default.yaml @@ -17,6 +17,10 @@ meilisearch: channels: 'peertube-index-channels' playlists: 'peertube-index-playlists' + # Avoid updating index settings at startup + # Set to true when a new release of the search index updates index settings + force_settings_update_at_startup: false + log: level: 'debug' # debug/info/warning/error diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 3783659..252383a 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts @@ -19,7 +19,8 @@ const CONFIG = { VIDEOS: config.get('meilisearch.indexes.videos'), CHANNELS: config.get('meilisearch.indexes.channels'), PLAYLISTS: config.get('meilisearch.indexes.playlists') - } + }, + FORCE_SETTINGS_UPDATE_AT_STARTUP: config.get('meilisearch.force_settings_update_at_startup') }, LOG: { LEVEL: config.get('log.level') diff --git a/server/lib/indexers/shared/abstract-indexer.ts b/server/lib/indexers/shared/abstract-indexer.ts index 0ff8246..31db4c8 100644 --- a/server/lib/indexers/shared/abstract-indexer.ts +++ b/server/lib/indexers/shared/abstract-indexer.ts @@ -48,12 +48,12 @@ export abstract class AbstractIndexer { async initIndex () { const { results } = await client.getIndexes() - if (results.some(r => r.uid === this.indexName)) { + if (!CONFIG.MEILISEARCH.FORCE_SETTINGS_UPDATE_AT_STARTUP && results.some(r => r.uid === this.indexName)) { logger.info(this.indexName + ' already exists, skipping configuration') return } - logger.info('Creating and configuring index ' + this.indexName) + logger.info(`Creating/updating "${this.indexName}" index settings`) await client.index(this.indexName).updateSearchableAttributes(this.searchableAttributes) await client.index(this.indexName).updateFilterableAttributes(this.filterableAttributes)