use cache server, fix bug studies filter
This commit is contained in:
parent
d2031f1ae9
commit
5751227cc3
|
|
@ -70,6 +70,14 @@ const {
|
||||||
}
|
}
|
||||||
return base
|
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,
|
isUnlocked: () => unlocked.value,
|
||||||
pageSize: () => settings.pageSize,
|
pageSize: () => settings.pageSize,
|
||||||
paginationType: () => settings.paginationType,
|
paginationType: () => settings.paginationType,
|
||||||
|
|
@ -107,7 +115,9 @@ async function applyBibleStudyFilter() {
|
||||||
queryBy: 'title',
|
queryBy: 'title',
|
||||||
filterBy: `bible_study:=${val}`,
|
filterBy: `bible_study:=${val}`,
|
||||||
perPage: 1,
|
perPage: 1,
|
||||||
includeFields: 'bible_study,title'
|
includeFields: 'bible_study,title',
|
||||||
|
useCache: true,
|
||||||
|
cacheTtl: 3600
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,9 @@ export function useDocumentDetailFetch() {
|
||||||
q: '*',
|
q: '*',
|
||||||
queryBy: 'title',
|
queryBy: 'title',
|
||||||
filterBy: `id:=${docId} && $${paragraphsCollection}(id: *)`,
|
filterBy: `id:=${docId} && $${paragraphsCollection}(id: *)`,
|
||||||
includeFields: `*, $${paragraphsCollection}(*)`
|
includeFields: `*, $${paragraphsCollection}(*)`,
|
||||||
|
useCache: true,
|
||||||
|
cacheTtl: 3600
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
}, { signal })
|
}, { signal })
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,9 @@ export function useFilters() {
|
||||||
queryBy: 'title',
|
queryBy: 'title',
|
||||||
filterBy: `bible_study:=${val}`,
|
filterBy: `bible_study:=${val}`,
|
||||||
perPage: 1,
|
perPage: 1,
|
||||||
includeFields: 'bible_study,title'
|
includeFields: 'bible_study,title',
|
||||||
|
useCache: true,
|
||||||
|
cacheTtl: 3600
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -249,6 +249,7 @@ export interface GroupedTypesenseSearchOptions {
|
||||||
queryBy: string
|
queryBy: string
|
||||||
/** Reevaluado en cada request (p.ej. depende de `locale.value`). */
|
/** Reevaluado en cada request (p.ej. depende de `locale.value`). */
|
||||||
filterBy: () => string
|
filterBy: () => string
|
||||||
|
browseFilterBy?: () => string
|
||||||
/** Cuando devuelve false, se excluyen los documentos `private:=true`. */
|
/** Cuando devuelve false, se excluyen los documentos `private:=true`. */
|
||||||
isUnlocked: () => boolean
|
isUnlocked: () => boolean
|
||||||
pageSize: () => number
|
pageSize: () => number
|
||||||
|
|
@ -341,9 +342,10 @@ export function useGroupedTypesenseSearch(options: GroupedTypesenseSearchOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
function browseFilterBy() {
|
function browseFilterBy() {
|
||||||
|
const base = options.browseFilterBy ? options.browseFilterBy() : options.filterBy()
|
||||||
return options.isUnlocked()
|
return options.isUnlocked()
|
||||||
? options.filterBy()
|
? base
|
||||||
: `${options.filterBy()} && private:=false`
|
: `${base} && private:=false`
|
||||||
}
|
}
|
||||||
|
|
||||||
const runner = createAbortableRunner()
|
const runner = createAbortableRunner()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue