mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-04 21:59:58 -05:00
search: don't COUNT(*) OVER() the page query (#702)
COUNT(*) OVER() forced SQLite to visit every matching file_group before LIMIT, which is a full table scan of the (large) file_group table — ~22s cold on a Pi for videos ordered by download date. Count separately and cache for 60s by filters so indexed orders can stop after one page. Past-the-end pages now report the true total. Videos/archives/docs pagers keep totalPages across page changes.
This commit is contained in:
parent
0b61d3ab08
commit
8008cd1fd8
9 changed files with 436 additions and 74 deletions
|
|
@ -523,7 +523,6 @@ export const useSearchArchives = (defaultLimit) => {
|
|||
|
||||
const localSearchArchives = async () => {
|
||||
setArchives(null);
|
||||
setTotalPages(0);
|
||||
try {
|
||||
let [archives_, total] = await searchArchives(offset, limit, domain, searchStr, order, activeTags, headline,
|
||||
deep);
|
||||
|
|
@ -594,7 +593,6 @@ export const useSearchDocs = (defaultLimit) => {
|
|||
|
||||
const localSearchDocs = async () => {
|
||||
setDocs(null);
|
||||
setTotalPages(0);
|
||||
try {
|
||||
const mimetype = docFilterToMimetype(filter);
|
||||
let [docs_, total] = await searchDocs(offset, limit, searchStr, order, activeTags, author, subject,
|
||||
|
|
@ -657,7 +655,6 @@ export const useSearchVideos = (defaultLimit, channelId, order_by) => {
|
|||
const localSearchVideos = async () => {
|
||||
setVideos(null);
|
||||
setLoading(true);
|
||||
setTotalPages(0);
|
||||
try {
|
||||
let [videos_, total] = await searchVideos(offset, limit, channelId, searchStr, order, activeTags, headline,
|
||||
censored, deep);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue