Improved scene actors filter.

This commit is contained in:
2024-01-07 23:44:33 +01:00
parent e32a366fff
commit 43949185c2
11 changed files with 456 additions and 90 deletions

View File

@@ -238,8 +238,10 @@ export async function fetchScenes(filters, rawOptions) {
}),
});
const actorCounts = result.aggregations?.actorIds && Object.fromEntries(result.aggregations?.actorIds?.buckets.map((bucket) => [bucket.key, { count: bucket.doc_count }]));
const [actors] = await Promise.all([
options.aggregate ? fetchActorsById(result.aggregations.actorIds.buckets.map((bucket) => bucket.key), { order: ['name', 'asc'] }) : [],
result.aggregations?.actorIds ? fetchActorsById(result.aggregations.actorIds.buckets.map((bucket) => bucket.key), { order: ['name', 'asc'], append: actorCounts }) : [],
]);
const sceneIds = result.hits.hits.map((hit) => Number(hit._id));