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,
}, pageContext.user);
const {
movies,
aggActors,
aggTags,
aggChannels,
total,
limit,
} = movieResults;
return {
pageContext: {
title: `${stash.name} by ${stash.user.username}`,
pageProps: {
stash,
movies,
aggActors,
aggTags,
aggChannels,
total,
limit,
...movieResults,
},
},
};

View File

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

View File

@ -227,7 +227,7 @@ async function queryManticoreSql(filters, options) {
movies.stashed as stashed,
movies.created_at,
created_at as stashed_at,
year(effective_date) as effective_year,
year(movies.effective_date) as effective_year,
weight() as _score
`));
@ -237,7 +237,7 @@ async function queryManticoreSql(filters, options) {
} else {
builder.select(knex.raw(`
*,
year(effective_date) as effective_year,
year(movies.effective_date) as effective_year,
weight() as _score
`));
}
@ -303,7 +303,7 @@ async function queryManticoreSql(filters, options) {
.offset((options.page - 1) * options.limit)
.toString(),
// 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,
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,

View File

@ -354,7 +354,7 @@ async function queryManticoreSql(filters, options, _reqUser) {
scenes.stashed as stashed,
scenes.created_at,
created_at as stashed_at,
year(effective_date) as effective_year,
year(scenes.effective_date) as effective_year,
weight() as _score
`));
@ -364,7 +364,7 @@ async function queryManticoreSql(filters, options, _reqUser) {
} else {
builder.select(knex.raw(`
*,
year(effective_date) as effective_year,
year(scenes.effective_date) as effective_year,
weight() as _score
`));
}
@ -463,7 +463,7 @@ async function queryManticoreSql(filters, options, _reqUser) {
.limit(options.limit)
.offset((options.page - 1) * options.limit),
// 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,
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,