Applying global vs actor tag toggle to scene results.

This commit is contained in:
2026-07-03 03:18:33 +02:00
parent e04ddaed9b
commit cb91cd4cc7
4 changed files with 17 additions and 1 deletions

View File

@@ -224,6 +224,8 @@ const groupedTags = computed(() => {
}); });
function toggleTag(tag, combine) { function toggleTag(tag, combine) {
emit('update', 'onlyActorTags', showActorTags.value, false);
if (props.filters.tags.includes(tag.slug)) { if (props.filters.tags.includes(tag.slug)) {
emit('update', 'tags', props.filters.tags.filter((tagId) => tagId !== tag.slug)); emit('update', 'tags', props.filters.tags.filter((tagId) => tagId !== tag.slug));
return; return;

View File

@@ -287,6 +287,7 @@ const filters = ref({
search: urlParsed.search.q, search: urlParsed.search.q,
years: urlParsed.search.years?.split(',').filter(Boolean).map(Number) || [], years: urlParsed.search.years?.split(',').filter(Boolean).map(Number) || [],
tags: urlParsed.search.tags?.split(',').filter(Boolean) || [], tags: urlParsed.search.tags?.split(',').filter(Boolean) || [],
onlyActorTags: Object.hasOwn(urlParsed.search, 'at'),
entity: queryEntity, entity: queryEntity,
actors: queryActors, actors: queryActors,
}); });
@@ -346,6 +347,7 @@ async function search(options = {}) {
years: filters.value.years.join(',') || undefined, years: filters.value.years.join(',') || undefined,
actors: filters.value.actors.map((filterActor) => getActorIdentifier(filterActor)).join(',') || undefined, // don't include page actor ID in query, already a parameter actors: filters.value.actors.map((filterActor) => getActorIdentifier(filterActor)).join(',') || undefined, // don't include page actor ID in query, already a parameter
tags: filters.value.tags.join(',') || undefined, tags: filters.value.tags.join(',') || undefined,
at: (filters.value.tags.length > 0 && filters.value.onlyActorTags) || undefined,
// e: filters.value.entity?.type === 'network' ? `_${filters.value.entity.slug}` : (filters.value.entity?.slug || undefined), // e: filters.value.entity?.type === 'network' ? `_${filters.value.entity.slug}` : (filters.value.entity?.slug || undefined),
e: filters.value.entity ? `${entityPrefixes[filters.value.entity.type]}${filters.value.entity.slug}` : undefined, e: filters.value.entity ? `${entityPrefixes[filters.value.entity.type]}${filters.value.entity.slug}` : undefined,
}, { redirect: false }); }, { redirect: false });
@@ -355,6 +357,7 @@ async function search(options = {}) {
years: filters.value.years.filter(Boolean).join(','), // if we're on an actor page, that actor ID needs to be included years: filters.value.years.filter(Boolean).join(','), // if we're on an actor page, that actor ID needs to be included
actors: [pageActor, ...filters.value.actors].filter(Boolean).map((filterActor) => getActorIdentifier(filterActor)).join(','), // if we're on an actor page, that actor ID needs to be included actors: [pageActor, ...filters.value.actors].filter(Boolean).map((filterActor) => getActorIdentifier(filterActor)).join(','), // if we're on an actor page, that actor ID needs to be included
tags: [pageTag?.slug, ...filters.value.tags].filter(Boolean).join(','), tags: [pageTag?.slug, ...filters.value.tags].filter(Boolean).join(','),
at: !!filters.value.onlyActorTags,
stashId: pageStash?.id, stashId: pageStash?.id,
e: entitySlug, e: entitySlug,
scope: scope.value, scope: scope.value,

View File

@@ -498,7 +498,17 @@ async function queryManticoreSql(filters, options, _reqUser) {
} }
filters.tagIds?.forEach((tagId) => { filters.tagIds?.forEach((tagId) => {
builder.where('any(tag_ids)', tagId); if (filters.onlyActorTags) {
builder.where((whereBuilder) => {
whereBuilder.where('any(assigned_tag_ids)', tagId);
filters.actorIds?.forEach((actorId) => {
whereBuilder.orWhere('any(assigned_tag_ids)', actorId * 1_000_00 + tagId);
});
});
} else {
builder.where('any(tag_ids)', tagId);
}
}); });
if (filters.notTagIds) { if (filters.notTagIds) {

View File

@@ -44,6 +44,7 @@ export async function curateScenesQuery(query) {
notActorIds: splitActors.filter((actor) => actor.charAt(0) === '!').map((identifier) => parseActorIdentifier(identifier.slice(1))?.id).filter(Boolean), notActorIds: splitActors.filter((actor) => actor.charAt(0) === '!').map((identifier) => parseActorIdentifier(identifier.slice(1))?.id).filter(Boolean),
tagIds, tagIds,
notTagIds: notTagIds.filter((tagId) => !tagIds.includes(tagId)), // included tags get priority over excluded tags notTagIds: notTagIds.filter((tagId) => !tagIds.includes(tagId)), // included tags get priority over excluded tags
onlyActorTags: !!query.at,
entityId, entityId,
notEntityIds, notEntityIds,
movieId: Number(query.movieId) || null, movieId: Number(query.movieId) || null,