Fixed year query inside stash.

This commit is contained in:
DebaucheryLibrarian 2024-08-18 23:34:38 +02:00
parent fb574e62d4
commit 0ad62a7305
4 changed files with 8 additions and 36 deletions

View File

@ -19,26 +19,12 @@ export async function onBeforeRender(pageContext) {
limit: Number(pageContext.urlParsed.search.limit) || 50, limit: Number(pageContext.urlParsed.search.limit) || 50,
}, pageContext.user); }, pageContext.user);
const {
movies,
aggActors,
aggTags,
aggChannels,
total,
limit,
} = movieResults;
return { return {
pageContext: { pageContext: {
title: `${stash.name} by ${stash.user.username}`, title: `${stash.name} by ${stash.user.username}`,
pageProps: { pageProps: {
stash, stash,
movies, ...movieResults,
aggActors,
aggTags,
aggChannels,
total,
limit,
}, },
}, },
}; };

View File

@ -20,26 +20,12 @@ export async function onBeforeRender(pageContext) {
limit: Number(pageContext.urlParsed.search.limit) || 30, limit: Number(pageContext.urlParsed.search.limit) || 30,
}, pageContext.user); }, pageContext.user);
const {
scenes,
aggActors,
aggTags,
aggChannels,
total,
limit,
} = stashScenes;
return { return {
pageContext: { pageContext: {
title: `${stash.name} by ${stash.user.username}`, title: `${stash.name} by ${stash.user.username}`,
pageProps: { pageProps: {
stash, stash,
scenes, ...stashScenes,
aggActors,
aggTags,
aggChannels,
total,
limit,
}, },
}, },
}; };

View File

@ -227,7 +227,7 @@ async function queryManticoreSql(filters, options) {
movies.stashed as stashed, movies.stashed as stashed,
movies.created_at, movies.created_at,
created_at as stashed_at, created_at as stashed_at,
year(effective_date) as effective_year, year(movies.effective_date) as effective_year,
weight() as _score weight() as _score
`)); `));
@ -237,7 +237,7 @@ async function queryManticoreSql(filters, options) {
} else { } else {
builder.select(knex.raw(` builder.select(knex.raw(`
*, *,
year(effective_date) as effective_year, year(movies.effective_date) as effective_year,
weight() as _score weight() as _score
`)); `));
} }
@ -303,7 +303,7 @@ async function queryManticoreSql(filters, options) {
.offset((options.page - 1) * options.limit) .offset((options.page - 1) * options.limit)
.toString(), .toString(),
// option threads=1 fixes actors, but drastically slows down performance, wait for fix // option threads=1 fixes actors, but drastically slows down performance, wait for fix
yearsFacet: options.aggregateYears ? knex.raw('facet year(effective_date) as years order by years desc limit ?', [aggSize]) : null, yearsFacet: options.aggregateYears ? knex.raw('facet effective_year as years order by effective_year desc limit ?', [aggSize]) : null,
actorsFacet: options.aggregateActors ? knex.raw('facet movies.actor_ids order by count(*) desc limit ?', [aggSize]) : null, actorsFacet: options.aggregateActors ? knex.raw('facet movies.actor_ids order by count(*) desc limit ?', [aggSize]) : null,
tagsFacet: options.aggregateTags ? knex.raw('facet movies.tag_ids order by count(*) desc limit ?', [aggSize]) : null, tagsFacet: options.aggregateTags ? knex.raw('facet movies.tag_ids order by count(*) desc limit ?', [aggSize]) : null,
channelsFacet: options.aggregateChannels ? knex.raw('facet movies.channel_id order by count(*) desc limit ?', [aggSize]) : null, channelsFacet: options.aggregateChannels ? knex.raw('facet movies.channel_id order by count(*) desc limit ?', [aggSize]) : null,

View File

@ -354,7 +354,7 @@ async function queryManticoreSql(filters, options, _reqUser) {
scenes.stashed as stashed, scenes.stashed as stashed,
scenes.created_at, scenes.created_at,
created_at as stashed_at, created_at as stashed_at,
year(effective_date) as effective_year, year(scenes.effective_date) as effective_year,
weight() as _score weight() as _score
`)); `));
@ -364,7 +364,7 @@ async function queryManticoreSql(filters, options, _reqUser) {
} else { } else {
builder.select(knex.raw(` builder.select(knex.raw(`
*, *,
year(effective_date) as effective_year, year(scenes.effective_date) as effective_year,
weight() as _score weight() as _score
`)); `));
} }
@ -463,7 +463,7 @@ async function queryManticoreSql(filters, options, _reqUser) {
.limit(options.limit) .limit(options.limit)
.offset((options.page - 1) * options.limit), .offset((options.page - 1) * options.limit),
// option threads=1 fixes actors, but drastically slows down performance, wait for fix // option threads=1 fixes actors, but drastically slows down performance, wait for fix
yearsFacet: options.aggregateYears ? knex.raw('facet year(effective_date) as years order by years desc limit ?', [aggSize]) : null, yearsFacet: options.aggregateYears ? knex.raw('facet effective_year as years order by effective_year desc limit ?', [aggSize]) : null,
actorsFacet: options.aggregateActors ? knex.raw('facet scenes.actor_ids order by count(*) desc limit ?', [aggSize]) : null, actorsFacet: options.aggregateActors ? knex.raw('facet scenes.actor_ids order by count(*) desc limit ?', [aggSize]) : null,
tagsFacet: options.aggregateTags ? knex.raw('facet scenes.tag_ids order by count(*) desc limit ?', [aggSize]) : null, tagsFacet: options.aggregateTags ? knex.raw('facet scenes.tag_ids order by count(*) desc limit ?', [aggSize]) : null,
channelsFacet: options.aggregateChannels ? knex.raw('facet scenes.channel_id order by count(*) desc limit ?', [aggSize]) : null, channelsFacet: options.aggregateChannels ? knex.raw('facet scenes.channel_id order by count(*) desc limit ?', [aggSize]) : null,