use cache server, fix bug studies filter

This commit is contained in:
David Ascanio 2026-07-26 09:49:59 -03:00
parent d2031f1ae9
commit 5751227cc3
4 changed files with 21 additions and 5 deletions

View File

@ -70,6 +70,14 @@ const {
}
return base
},
browseFilterBy: () => {
let base = `locale:=${locale.value}`
if (activeBibleStudies.value.length > 0) {
const ids = activeBibleStudies.value.map(bs => bs.id).join(',')
base += ` && bible_study:=[${ids}]`
}
return base
},
isUnlocked: () => unlocked.value,
pageSize: () => settings.pageSize,
paginationType: () => settings.paginationType,
@ -107,7 +115,9 @@ async function applyBibleStudyFilter() {
queryBy: 'title',
filterBy: `bible_study:=${val}`,
perPage: 1,
includeFields: 'bible_study,title'
includeFields: 'bible_study,title',
useCache: true,
cacheTtl: 3600
}]
}
})

View File

@ -58,7 +58,9 @@ export function useDocumentDetailFetch() {
q: '*',
queryBy: 'title',
filterBy: `id:=${docId} && $${paragraphsCollection}(id: *)`,
includeFields: `*, $${paragraphsCollection}(*)`
includeFields: `*, $${paragraphsCollection}(*)`,
useCache: true,
cacheTtl: 3600
}]
}
}, { signal })

View File

@ -34,7 +34,9 @@ export function useFilters() {
queryBy: 'title',
filterBy: `bible_study:=${val}`,
perPage: 1,
includeFields: 'bible_study,title'
includeFields: 'bible_study,title',
useCache: true,
cacheTtl: 3600
}]
}
})

View File

@ -249,6 +249,7 @@ export interface GroupedTypesenseSearchOptions {
queryBy: string
/** Reevaluado en cada request (p.ej. depende de `locale.value`). */
filterBy: () => string
browseFilterBy?: () => string
/** Cuando devuelve false, se excluyen los documentos `private:=true`. */
isUnlocked: () => boolean
pageSize: () => number
@ -341,9 +342,10 @@ export function useGroupedTypesenseSearch(options: GroupedTypesenseSearchOptions
}
function browseFilterBy() {
const base = options.browseFilterBy ? options.browseFilterBy() : options.filterBy()
return options.isUnlocked()
? options.filterBy()
: `${options.filterBy()} && private:=false`
? base
: `${base} && private:=false`
}
const runner = createAbortableRunner()