Commit 2cab70c7 authored by Dominik Hebeler's avatar Dominik Hebeler

Fixed resultloader

parent 03e5fe7a
......@@ -63,7 +63,15 @@ class MetaGerSearch extends Controller
# Ergebnisse der Suchmaschinen kombinieren:
$metager->prepareResults();
\App\CacheHelper::put($metager->getSearchUid(), $metager->getEngines(), 1 * 60);
$finished = true;
foreach ($metager->getEngines() as $engine) {
if ($engine->loaded) {
$engine->setNew(false);
$engine->markNew();
}
}
\App\CacheHelper::put("loader_" . $metager->getSearchUid(), $metager->getEngines(), 60 * 60);
# Die Ausgabe erstellen:
$resultpage = $metager->createView($quicktipResults);
......@@ -112,18 +120,7 @@ class MetaGerSearch extends Controller
return response()->json(['finished' => true]);
}
// Mark all engines that are already loaded
$finished = true;
foreach ($engines as $engine) {
if ($engine->loaded) {
$engine->setNew(false);
} else {
$finished = false;
$engine->setNew(true);
}
}
$metager = new MetaGer($hash);
$metager = new MetaGer(substr($hash, strpos($hash, "loader_") + 7));
$metager->parseFormData($request);
# Nach Spezialsuchen überprüfen:
......@@ -156,8 +153,20 @@ class MetaGerSearch extends Controller
}
}
$finished = true;
foreach ($engines as $engine) {
if (!$engine->loaded) {
$finished = false;
} else {
$engine->setNew(false);
$engine->markNew();
}
}
$result["finished"] = $finished;
// Update new Engines
\App\CacheHelper::put($metager->getSearchUid(), $metager->getEngines(), 1 * 60);
\App\CacheHelper::put("loader_" . $metager->getSearchUid(), $metager->getEngines(), 1 * 60);
return response()->json($result);
}
......
......@@ -71,6 +71,7 @@ class MetaGer
protected $verificationCount;
protected $searchUid;
protected $redisResultWaitingKey, $redisResultEngineList, $redisEngineResult, $redisCurrentResultList;
public $starttime;
public function __construct($hash = "")
{
......
......@@ -51,7 +51,7 @@ abstract class Searchengine
$this->useragent = $metager->getUserAgent();
$this->ip = $metager->getIp();
$this->startTime = microtime();
$this->startTime = microtime(true);
# check for http Auth
if (!empty($this->engine->{"http-auth-credentials"}->username) && !empty($this->engine->{"http-auth-credentials"}->password)) {
$this->username = $this->engine->{"http-auth-credentials"}->username;
......@@ -192,7 +192,7 @@ abstract class Searchengine
}
}
protected function markNew()
public function markNew()
{
foreach ($this->results as $result) {
$result->new = $this->new;
......
......@@ -55,7 +55,7 @@ function enableFormResetter() {
function loadMoreResults() {
var searchKey = $("meta[name=searchkey]").attr("content");
var updateUrl = document.location.href;
updateUrl += "&loadMore=" + searchKey + "&script=yes";
updateUrl += "&loadMore=loader_" + searchKey + "&script=yes";
updateUrl = updateUrl.replace("/meta.ger3", "/loadMore");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment