diff --git a/app/Http/Controllers/MetaGerSearch.php b/app/Http/Controllers/MetaGerSearch.php index 22289cad828c7a27ab621c1c9282239cdd9944cf..025be641dc3dff49d37d850274e470679da031fd 100644 --- a/app/Http/Controllers/MetaGerSearch.php +++ b/app/Http/Controllers/MetaGerSearch.php @@ -76,10 +76,21 @@ class MetaGerSearch extends Controller return response($responseContent); } + $quicktips = $metager->createQuicktips(); + if (!empty($timings)) { + $timings["createQuicktips"] = microtime(true) - $time; + } + # Suche für alle zu verwendenden Suchmaschinen als Job erstellen, # auf Ergebnisse warten und die Ergebnisse laden $metager->createSearchEngines($request, $timings); + # Versuchen die Ergebnisse der Quicktips zu laden + $quicktipResults = $quicktips->loadResults(); + if (!empty($timings)) { + $timings["loadResults"] = microtime(true) - $time; + } + $metager->startSearch($timings); $metager->waitForMainResults(); @@ -128,7 +139,7 @@ class MetaGerSearch extends Controller } # Die Ausgabe erstellen: - $resultpage = $metager->createView(); + $resultpage = $metager->createView($quicktipResults); if ($spamEntry !== null) { try { Cache::put('spam.' . $metager->getFokus() . "." . md5($spamEntry), $resultpage->render(), 604800); diff --git a/app/MetaGer.php b/app/MetaGer.php index 0a3be40d6add9ba73c0a2c905d69706d27f83df3..5834d96dfaa63a70e56ccb76c8f80b00a1fee560 100644 --- a/app/MetaGer.php +++ b/app/MetaGer.php @@ -135,7 +135,7 @@ class MetaGer } # Erstellt aus den gesammelten Ergebnissen den View - public function createView() + public function createView($quicktipResults = []) { # Hiermit werden die evtl. ausgewählten SuMas extrahiert, damit die Input-Boxen richtig gesetzt werden können $focusPages = []; @@ -175,7 +175,7 @@ class MetaGer ->with('apiAuthorized', $this->apiAuthorized) ->with('metager', $this) ->with('browser', (new Agent())->browser()) - ->with('quicktips', action('MetaGerSearch@quicktips', ["search" => $this->eingabe])) + ->with('quicktips', $quicktipResults) ->with('focus', $this->fokus) ->with('resultcount', count($this->results)); } @@ -248,7 +248,7 @@ class MetaGer ->with('apiAuthorized', $this->apiAuthorized) ->with('metager', $this) ->with('browser', (new Agent())->browser()) - ->with('quicktips', action('MetaGerSearch@quicktips', ["search" => $this->eingabe, "quotes" => $this->sprueche])) + ->with('quicktips', $quicktipResults) ->with('resultcount', count($this->results)) ->with('focus', $this->fokus); break; @@ -1213,6 +1213,15 @@ class MetaGer } } + public function createQuicktips() + { + # Die quicktips werden als job erstellt und zur Abarbeitung freigegeben + $quicktips = new \App\Models\Quicktips\Quicktips($this->q, LaravelLocalization::getCurrentLocale(), $this->getTime()); + return $quicktips; + } + + + private function anonymizeIp($ip) { if (str_contains($ip, ":")) { diff --git a/app/Models/Quicktips/Quicktip.php b/app/Models/Quicktips/Quicktip.php index 4d7201ca2799b6dfef48f94663d37bc5fe076ca9..8b137891791fe96927ad78e64b0aad7bded08bdc 100644 --- a/app/Models/Quicktips/Quicktip.php +++ b/app/Models/Quicktips/Quicktip.php @@ -1,28 +1 @@ -type = $type; - $this->title = $title; - $this->link = $link; - $this->gefVonTitle = $gefVonTitle; - $this->gefVonLink = $gefVonLink; - $this->author = $author; - $this->descr = $descr; - $this->details = $details; - } -} diff --git a/resources/views/layouts/researchandtabs.blade.php b/resources/views/layouts/researchandtabs.blade.php index 17a26ccd3eae3913021bea12859c68c075c6baac..93ffeba5a9a6fd47130bc00c98006a4d61161049 100644 --- a/resources/views/layouts/researchandtabs.blade.php +++ b/resources/views/layouts/researchandtabs.blade.php @@ -35,9 +35,7 @@
@include('layouts.keyboardNavBox') @if( $metager->showQuicktips() ) -
- -
+ @include('quicktips', ['quicktips', $quicktips]) @endif
@include('parts.footer', ['type' => 'resultpage', 'id' => 'resultPageFooter']) diff --git a/resources/views/quicktips.blade.php b/resources/views/quicktips.blade.php index 6fa679cf65fd25ab3e02af788260f55783900250..f354bda8b7ff7dadefffc7704e3bf4325b39b28b 100644 --- a/resources/views/quicktips.blade.php +++ b/resources/views/quicktips.blade.php @@ -1,19 +1,5 @@ - - - - - - {{ $search }} - MetaGer Quicktips - - - - - - @foreach($quicktips as $quicktip)
@include('parts.quicktip', ['quicktip' => $quicktip])
-@endforeach - - +@endforeach \ No newline at end of file