Commit 86cc740d authored by Phil Höfer's avatar Phil Höfer

Merge branch '262-metager-code-entzerren' into 'development'

combineResults teilsepariert

das eigentliche Kombinieren der Ergebnisse ist jetzt in einer eigenen Methode. Die restlichen Bestandteile müssen noch aufgeteilt werden.

See merge request !460
parents acd66ef3 901024f4
......@@ -28,7 +28,7 @@ class MetaGerSearch extends Controller
$metager->rankAll();
# Ergebnisse der Suchmaschinen kombinieren:
$metager->combineResults();
$metager->prepareResults();
# Die Ausgabe erstellen:
return $metager->createView();
......
......@@ -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) {
......
......@@ -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)) {
......
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