Support description truncation config

This commit is contained in:
Chocobozzz 2024-06-11 16:39:56 +02:00
parent 4064d313fc
commit 4b17bfa14f
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 8 additions and 2 deletions

View File

@ -65,3 +65,6 @@ indexer:
# How much time to wait before bulk indexing in Meilisearch data # How much time to wait before bulk indexing in Meilisearch data
bulk_indexation_interval_ms: 10000 bulk_indexation_interval_ms: 10000
videos:
max_description_characters: 250

View File

@ -49,7 +49,10 @@ const CONFIG = {
}, },
INDEXER: { INDEXER: {
HOST_CONCURRENCY: config.get<number>('indexer.host_concurrency'), HOST_CONCURRENCY: config.get<number>('indexer.host_concurrency'),
BULK_INDEXATION_INTERVAL_MS: config.get<number>('indexer.bulk_indexation_interval_ms') BULK_INDEXATION_INTERVAL_MS: config.get<number>('indexer.bulk_indexation_interval_ms'),
VIDEOS: {
MAX_DESCRIPTION_CHARACTERS: config.get<number>('indexer.videos.max_description_characters')
}
} }
} }

View File

@ -128,7 +128,7 @@ export function formatVideoForDB (v: IndexableVideo | IndexableVideoDetails): DB
truncatedDescription: v.truncatedDescription, truncatedDescription: v.truncatedDescription,
description: v.description, description: v.description,
searchableDescription: (v.description || v.truncatedDescription || '').slice(0, 250), searchableDescription: (v.description || v.truncatedDescription || '').slice(0, CONFIG.INDEXER.VIDEOS.MAX_DESCRIPTION_CHARACTERS),
waitTranscoding: v.waitTranscoding, waitTranscoding: v.waitTranscoding,