From 170709bb4dc2db75b3a5a5d338874fbc353e1b1c Mon Sep 17 00:00:00 2001
From: Jared Hancock <gravydish@gmail.com>
Date: Fri, 19 Oct 2018 02:30:34 +0000
Subject: [PATCH] search: Add pagination support to advanced searches

This is pretty weak as implemented, but one of the problems with
searching speed is that, for each page render, the count of the hits is
required. But now the hits query does not actually collect the count for
the search queue. What's worse, the code collects counts for all saved
queues (not including the advanced search), so the counts are not
included. Then, the code re-collects the counts for all the queues since
the advanced search queue count isn't available. Then, since there still
is no count for the advanced search, it will show "0" results after
waiting to count all the other queues.

This cowardly fixes the issue by assuming there are 500 hits, which
allows a few pages. In reality, the pagination system should be rewired
so that it can dynamically add pages until it comes up with a short
read of results, in which case it can assume that it has reached the
end.
---
 include/class.search.php | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/class.search.php b/include/class.search.php
index f5034d1f3..bc44af16b 100644
--- a/include/class.search.php
+++ b/include/class.search.php
@@ -956,6 +956,10 @@ class SavedSearch extends SavedQueue {
     function isSaved() {
         return (!$this->__new__);
     }
+
+    function getCount($agent, $cached=true) {
+        return 500;
+    }
 }
 
 class AdhocSearch
-- 
GitLab