Integrated channel filter, partially restored actor bio.
This commit is contained in:
@@ -80,25 +80,17 @@ export async function fetchScenesById(sceneIds) {
|
||||
.groupBy('channels.id', 'networks.id'),
|
||||
knex('releases_actors')
|
||||
.select(
|
||||
'actors.*',
|
||||
'actors_meta.*',
|
||||
'releases_actors.release_id',
|
||||
'avatars.id as avatar_id',
|
||||
'avatars.path as avatar_path',
|
||||
'avatars.thumbnail as avatar_thumbnail',
|
||||
'avatars.lazy as avatar_lazy',
|
||||
'avatars.width as avatar_width',
|
||||
'avatars.height as avatar_height',
|
||||
'avatars.is_s3 as avatar_s3',
|
||||
'birth_countries.alpha2 as birth_country_alpha2',
|
||||
'birth_countries.name as birth_country_name',
|
||||
'residence_countries.alpha2 as residence_country_alpha2',
|
||||
'residence_countries.name as residence_country_name',
|
||||
)
|
||||
.whereIn('release_id', sceneIds)
|
||||
.leftJoin('actors', 'actors.id', 'releases_actors.actor_id')
|
||||
.leftJoin('media as avatars', 'avatars.id', 'actors.avatar_media_id')
|
||||
.leftJoin('countries as birth_countries', 'birth_countries.alpha2', 'actors.birth_country_alpha2')
|
||||
.leftJoin('countries as residence_countries', 'residence_countries.alpha2', 'actors.residence_country_alpha2'),
|
||||
.leftJoin('actors_meta', 'actors_meta.id', 'releases_actors.actor_id')
|
||||
.leftJoin('countries as birth_countries', 'birth_countries.alpha2', 'actors_meta.birth_country_alpha2')
|
||||
.leftJoin('countries as residence_countries', 'residence_countries.alpha2', 'actors_meta.residence_country_alpha2'),
|
||||
knex('releases_directors')
|
||||
.whereIn('release_id', sceneIds)
|
||||
.leftJoin('actors as directors', 'directors.id', 'releases_directors.director_id'),
|
||||
@@ -191,23 +183,26 @@ function buildQuery(filters = {}) {
|
||||
sort = [{ created_at: 'desc' }, { effective_date: 'asc' }];
|
||||
}
|
||||
|
||||
if (filters.actorIds) {
|
||||
filters.actorIds.forEach((actorId) => {
|
||||
query.bool.must.push({
|
||||
equals: {
|
||||
'any(actor_ids)': actorId,
|
||||
},
|
||||
});
|
||||
if (filters.tagIds) {
|
||||
filters.tagIds.forEach((tagId) => {
|
||||
query.bool.must.push({ equals: { 'any(tag_ids)': tagId } });
|
||||
});
|
||||
}
|
||||
|
||||
if (filters.tagIds) {
|
||||
filters.tagIds.forEach((tagId) => {
|
||||
query.bool.must.push({
|
||||
equals: {
|
||||
'any(tag_ids)': tagId,
|
||||
},
|
||||
});
|
||||
if (filters.entityId) {
|
||||
query.bool.must.push({
|
||||
bool: {
|
||||
should: [
|
||||
{ equals: { channel_id: filters.entityId } },
|
||||
{ equals: { network_id: filters.entityId } },
|
||||
],
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (filters.actorIds) {
|
||||
filters.actorIds.forEach((actorId) => {
|
||||
query.bool.must.push({ equals: { 'any(actor_ids)': actorId } });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -221,8 +216,6 @@ function buildQuery(filters = {}) {
|
||||
],
|
||||
*/
|
||||
|
||||
console.log(query.bool.must);
|
||||
|
||||
return { query, sort };
|
||||
}
|
||||
|
||||
@@ -272,9 +265,6 @@ export async function fetchScenes(filters, rawOptions) {
|
||||
const options = curateOptions(rawOptions);
|
||||
const { query, sort } = buildQuery(filters);
|
||||
|
||||
console.log('filters', filters);
|
||||
console.log('options', options);
|
||||
|
||||
const result = await searchApi.search({
|
||||
index: 'scenes',
|
||||
query,
|
||||
|
||||
Reference in New Issue
Block a user