diff --git a/app/Http/Controllers/MetaGerSearch.php b/app/Http/Controllers/MetaGerSearch.php index 86a423dfb693803c9d3f7ca0d632f529eb5be955..a7824f40b79004413be8d69030889b2046416c19 100644 --- a/app/Http/Controllers/MetaGerSearch.php +++ b/app/Http/Controllers/MetaGerSearch.php @@ -28,7 +28,7 @@ class MetaGerSearch extends Controller $metager->rankAll(); # Ergebnisse der Suchmaschinen kombinieren: - $metager->combineResults(); + $metager->prepareResults(); # Die Ausgabe erstellen: return $metager->createView(); diff --git a/app/MetaGer.php b/app/MetaGer.php index c29d45c8181e8578c16b7eb2e2a75a4ae60d533d..aaacb294800167ca85621a8e7ac8f7b0be3d8aec 100644 --- a/app/MetaGer.php +++ b/app/MetaGer.php @@ -156,28 +156,18 @@ class MetaGer } } - public function combineResults() - { - foreach ($this->engines as $engine) { - if (isset($engine->next)) { - $this->next[] = $engine->next; - } - if (isset($engine->last)) { - $this->last[] = $engine->last; - } - foreach ($engine->results as $result) { - if ($result->valid) { - $this->results[] = $result; - } - } - foreach ($engine->ads as $ad) { - $this->ads[] = $ad; - } - foreach ($engine->products as $product) { - $this->products[] = $product; - } - } - + public function prepareResults() + { + $engines = $this->engines; + + // combine + $combinedResults = $this->combineResults($engines); + // sort + //$sortedResults = $this->sortResults($engines); + // filter + // augment (boost&adgoal) + // authorize + // misc (WiP) uasort($this->results, function ($a, $b) { if ($a->getRank() == $b->getRank()) { return 0; @@ -275,6 +265,30 @@ class MetaGer } + public function combineResults($engines) + { + foreach ($engines as $engine) { + if (isset($engine->next)) { + $this->next[] = $engine->next; + } + if (isset($engine->last)) { + $this->last[] = $engine->last; + } + foreach ($engine->results as $result) { + if ($result->valid) { + $this->results[] = $result; + } + } + foreach ($engine->ads as $ad) { + $this->ads[] = $ad; + } + foreach ($engine->products as $product) { + $this->products[] = $product; + } + } + + } + public function parseBoost($results) { foreach ($results as $result) { diff --git a/app/Models/Result.php b/app/Models/Result.php index 7b871c7ccc5340e09ed2fecb232ed4a499199222..73d0579f2c9d967be4f5563c7f09b40402c67425 100644 --- a/app/Models/Result.php +++ b/app/Models/Result.php @@ -233,7 +233,7 @@ class Result } } - /* Der Dublettefilter, der sicher stellt, + /* Der Dublettenfilter, der sicher stellt, * dass wir nach Möglichkeit keinen Link doppelt in der Ergebnisliste haben. */ if ($metager->addLink($this->strippedLink)) {