Compare commits

..

No commits in common. "da5e02be3dc5fecb52a04c87192a2423ff273b2e" and "3f36c0ae0a8e7c495501a037351de66bdd35ab76" have entirely different histories.

8 changed files with 77 additions and 117 deletions

View File

@ -1,88 +1,81 @@
<template> <template>
<div class="pagination-container"> <nav class="pagination">
<div <ul class="pages nolist">
v-if="currentPage === pageTotal && total > env.maxMatches" <li>
class="more" <Link
>Results are truncated, apply a filter to find more.</div> :href="getPath(1)"
:class="{ disabled: !hasPrevPage }"
class="page first nolink"
@click="(event) => go(1, event)"
><Icon icon="first2" /></Link>
</li>
<nav class="pagination"> <li>
<ul class="pages nolist"> <Link
<li> :href="hasPrevPage ? getPath(currentPage - 1) : null"
<Link :class="{ disabled: !hasPrevPage }"
:href="getPath(1)" class="page prev nolink"
:class="{ disabled: !hasPrevPage }" @click="(event) => hasPrevPage && go(currentPage - 1, event)"
class="page first nolink" ><Icon icon="arrow-left" /></Link>
@click="(event) => go(1, event)" </li>
><Icon icon="first2" /></Link> </ul>
</li>
<li> <div class="index">
<ul class="pages before wrap nolist">
<li
v-for="prevPage in prevPages"
:key="`page-${prevPage}`"
>
<Link <Link
:href="hasPrevPage ? getPath(currentPage - 1) : null" :href="getPath(prevPage)"
:class="{ disabled: !hasPrevPage }" :class="{ active: prevPage === currentPage }"
class="page prev nolink" class="page nolink"
@click="(event) => hasPrevPage && go(currentPage - 1, event)" @click="(event) => go(prevPage, event)"
><Icon icon="arrow-left" /></Link> >{{ prevPage }}</Link>
</li> </li>
</ul> </ul>
<div class="index">
<ul class="pages before wrap nolist">
<li
v-for="prevPage in prevPages"
:key="`page-${prevPage}`"
>
<Link
:href="getPath(prevPage)"
:class="{ active: prevPage === currentPage }"
class="page nolink"
@click="(event) => go(prevPage, event)"
>{{ prevPage }}</Link>
</li>
</ul>
<ul class="pages nolist">
<li>
<div class="page active">{{ currentPage }}</div>
</li>
</ul>
<ul class="pages after wrap nolist">
<li
v-for="nextPage in nextPages"
:key="`page-${nextPage}`"
>
<Link
:href="getPath(nextPage)"
:class="{ active: nextPage === currentPage }"
class="page nolink"
@click="(event) => go(nextPage, event)"
>{{ nextPage }}</Link>
</li>
</ul>
</div>
<ul class="pages nolist"> <ul class="pages nolist">
<li> <li>
<Link <div class="page active">{{ currentPage }}</div>
:href="hasNextPage ? getPath(currentPage + 1) : null"
:class="{ disabled: !hasNextPage }"
class="page next nolink"
@click="(event) => hasNextPage && go(currentPage + 1, event)"
><Icon icon="arrow-right" /></Link>
</li>
<li>
<Link
:href="getPath(pageTotal)"
:class="{ disabled: !hasNextPage }"
class="page last nolink"
@click="(event) => go(pageTotal, event)"
><Icon icon="last2" /></Link>
</li> </li>
</ul> </ul>
</nav>
</div> <ul class="pages after wrap nolist">
<li
v-for="nextPage in nextPages"
:key="`page-${nextPage}`"
>
<Link
:href="getPath(nextPage)"
:class="{ active: nextPage === currentPage }"
class="page nolink"
@click="(event) => go(nextPage, event)"
>{{ nextPage }}</Link>
</li>
</ul>
</div>
<ul class="pages nolist">
<li>
<Link
:href="hasNextPage ? getPath(currentPage + 1) : null"
:class="{ disabled: !hasNextPage }"
class="page next nolink"
@click="(event) => hasNextPage && go(currentPage + 1, event)"
><Icon icon="arrow-right" /></Link>
</li>
<li>
<Link
:href="getPath(pageTotal)"
:class="{ disabled: !hasNextPage }"
class="page last nolink"
@click="(event) => go(pageTotal, event)"
><Icon icon="last2" /></Link>
</li>
</ul>
</nav>
</template> </template>
<script setup> <script setup>
@ -110,28 +103,18 @@ const props = defineProps({
type: Boolean, type: Boolean,
default: true, default: true,
}, },
useMaxMatches: {
type: Boolean,
default: true,
},
}); });
const emit = defineEmits(['navigation']); const emit = defineEmits(['navigation']);
const pageContext = inject('pageContext'); const pageContext = inject('pageContext');
const { routeParams, urlParsed, pageProps } = pageContext;
const {
routeParams,
urlParsed,
pageProps,
env,
} = pageContext;
const currentPage = computed(() => props.page || Number(routeParams?.page)); const currentPage = computed(() => props.page || Number(routeParams?.page));
const limit = computed(() => props.limit || Number(pageProps.limit) || 30); const limit = computed(() => props.limit || Number(pageProps.limit) || 30);
const total = computed(() => props.total || Number(pageProps.total)); const total = computed(() => props.total || Number(pageProps.total));
const pageTotal = computed(() => Math.ceil((props.useMaxMatches ? Math.min(total.value, env.maxMatches) : total.value) / limit.value)); const pageTotal = computed(() => Math.ceil(total.value / limit.value));
const hasNextPage = computed(() => currentPage.value + 1 <= pageTotal.value); const hasNextPage = computed(() => currentPage.value + 1 <= pageTotal.value);
const hasPrevPage = computed(() => currentPage.value - 1 >= 1); const hasPrevPage = computed(() => currentPage.value - 1 >= 1);
@ -196,12 +179,6 @@ function getPath(page) {
</script> </script>
<style scoped> <style scoped>
.pagination-container {
display: flex;
flex-direction: column;
justify-content: center;
}
.pagination { .pagination {
height: 5rem; height: 5rem;
display: flex; display: flex;
@ -265,11 +242,4 @@ function getPath(page) {
.next { .next {
margin-left: .5rem; margin-left: .5rem;
} }
.more {
padding: 2rem;
text-align: center;
color: var(--shadow-strong-10);
font-size: 1.1rem;
}
</style> </style>

View File

@ -169,6 +169,8 @@ const scope = ref(routeParams.scope || props.defaultScope);
const total = ref(Number(pageProps.total)); const total = ref(Number(pageProps.total));
const loading = ref(false); const loading = ref(false);
console.log('SCOPE', routeParams.scope, scope.value);
const actorIds = urlParsed.search.actors?.split(',').map((identifier) => parseActorIdentifier(identifier)?.id).filter(Boolean) || []; const actorIds = urlParsed.search.actors?.split(',').map((identifier) => parseActorIdentifier(identifier)?.id).filter(Boolean) || [];
const queryActors = actorIds.map((urlActorId) => aggActors.value.find((aggActor) => aggActor.id === urlActorId)).filter(Boolean); const queryActors = actorIds.map((urlActorId) => aggActors.value.find((aggActor) => aggActor.id === urlActorId)).filter(Boolean);

View File

@ -28,7 +28,7 @@
/> />
<Icon <Icon
v-show="!favorited && user" v-show="!favorited"
icon="heart8" icon="heart8"
class="heart" class="heart"
@click.native.stop="stash" @click.native.stop="stash"

4
package-lock.json generated
View File

@ -1,11 +1,11 @@
{ {
"name": "traxxx-web", "name": "traxxx-web",
"version": "0.9.8", "version": "0.9.7",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"version": "0.9.8", "version": "0.9.7",
"dependencies": { "dependencies": {
"@brillout/json-serializer": "^0.5.8", "@brillout/json-serializer": "^0.5.8",
"@dicebear/collection": "^7.0.5", "@dicebear/collection": "^7.0.5",

View File

@ -70,5 +70,5 @@
"postcss-custom-media": "^10.0.2", "postcss-custom-media": "^10.0.2",
"postcss-nesting": "^12.0.2" "postcss-nesting": "^12.0.2"
}, },
"version": "0.9.8" "version": "0.9.7"
} }

View File

@ -1,4 +1,3 @@
import config from 'config';
import { differenceInYears } from 'date-fns'; import { differenceInYears } from 'date-fns';
import { unit } from 'mathjs'; import { unit } from 'mathjs';
@ -273,10 +272,6 @@ export async function fetchActors(filters, rawOptions) {
sort: [{ country: { order: 'asc' } }], sort: [{ country: { order: 'asc' } }],
}, },
}, },
options: {
max_matches: config.database.manticore.maxMatches,
max_query_time: config.database.manticore.maxQueryTime,
},
}); });
const actorIds = result.hits.hits.map((hit) => Number(hit._id)); const actorIds = result.hits.hits.map((hit) => Number(hit._id));

View File

@ -377,8 +377,7 @@ async function queryManticoreSql(filters, options, _reqUser) {
max_query_time=:maxQueryTime: max_query_time=:maxQueryTime:
:actorsFacet: :actorsFacet:
:tagsFacet: :tagsFacet:
:channelsFacet:; :channelsFacet:
show meta;
`, { `, {
query: knexManticore(filters.stashId ? 'scenes_stashed' : 'scenes') query: knexManticore(filters.stashId ? 'scenes_stashed' : 'scenes')
.modify((builder) => { .modify((builder) => {
@ -460,7 +459,6 @@ async function queryManticoreSql(filters, options, _reqUser) {
} }
}) })
.limit(options.limit) .limit(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
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,
@ -498,11 +496,9 @@ async function queryManticoreSql(filters, options, _reqUser) {
?.data.map((row) => ({ key: row.channel_id || row['scenes.channel_id'], doc_count: row['count(*)'] })) ?.data.map((row) => ({ key: row.channel_id || row['scenes.channel_id'], doc_count: row['count(*)'] }))
|| []; || [];
const total = results.at(-1).data.find((entry) => entry.Variable_name === 'total_found').Value;
return { return {
scenes: results[0].data, scenes: results[0].data,
total, total: results[0].total,
aggregations: { aggregations: {
actorIds, actorIds,
tagIds, tagIds,
@ -550,8 +546,6 @@ export async function fetchScenes(filters, rawOptions, reqUser) {
const scenes = await fetchScenesById(sceneIds, reqUser); const scenes = await fetchScenesById(sceneIds, reqUser);
console.timeEnd('fetch full'); console.timeEnd('fetch full');
console.log('total', result.total);
return { return {
scenes, scenes,
aggActors, aggActors,

View File

@ -148,7 +148,6 @@ export default async function initServer() {
env: { env: {
allowLogin: config.auth.login, allowLogin: config.auth.login,
allowSignup: config.auth.signup, allowSignup: config.auth.signup,
maxMatches: config.database.manticore.maxMatches,
maxAggregateSize: config.database.manticore.maxAggregateSize, maxAggregateSize: config.database.manticore.maxAggregateSize,
}, },
}; };