Commit 8d933c96 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Merge branch '486-ergebniskorrektur-bei-phrasensuchen' into 'development'

Resolve "Ergebnisranking bei Phrasensuchen"

Closes #486

See merge request !838
parents c022616c 81c8004f
...@@ -1145,7 +1145,7 @@ class MetaGer ...@@ -1145,7 +1145,7 @@ class MetaGer
public function rankAll() public function rankAll()
{ {
foreach ($this->engines as $engine) { foreach ($this->engines as $engine) {
$engine->rank($this->getQ()); $engine->rank($this->getQ(), $this->getPhrases());
} }
} }
......
...@@ -72,8 +72,9 @@ class Result ...@@ -72,8 +72,9 @@ class Result
* + 0.02 * Sourcerank (20 - Position in Ergebnisliste des Suchanbieters) * + 0.02 * Sourcerank (20 - Position in Ergebnisliste des Suchanbieters)
* * Engine-Boost * * Engine-Boost
*/ */
public function rank($eingabe) public function rank($eingabe, $phrases = [])
{ {
$rank = 0; $rank = 0;
# Boost für Source Ranking # Boost für Source Ranking
...@@ -95,6 +96,11 @@ class Result ...@@ -95,6 +96,11 @@ class Result
$rank -= $this->calcYandexBoost($eingabe); $rank -= $this->calcYandexBoost($eingabe);
} }
# Boost für Vorkommen der Suchwörter in der Beschreibung bei Phrasensuchen
if(!empty($phrases)) {
$rank += $this->calcPhraseSearchBoost($phrases);
}
$this->rank = $rank; $this->rank = $rank;
} }
...@@ -131,6 +137,18 @@ class Result ...@@ -131,6 +137,18 @@ class Result
return 0; return 0;
} }
# Berechnet den Ranking-Boost bei Phrasensuchen
private function calcPhraseSearchBoost($phrases) {
$containsPhrase = true;
foreach($phrases as $phrase) {
if(strstr($this->longDescr, $phrase) == false) {
$containsPhrase = false;
}
}
return $containsPhrase ? 0.1 : 0;
}
# Berechnet den Ranking-Boost durch ??? URL # Berechnet den Ranking-Boost durch ??? URL
public function calcURLBoost($tmpEingabe) public function calcURLBoost($tmpEingabe)
{ {
......
...@@ -182,10 +182,10 @@ abstract class Searchengine ...@@ -182,10 +182,10 @@ abstract class Searchengine
} }
# Ruft die Ranking-Funktion aller Ergebnisse auf. # Ruft die Ranking-Funktion aller Ergebnisse auf.
public function rank($eingabe) public function rank($eingabe, $phrases = [])
{ {
foreach ($this->results as $result) { foreach ($this->results as $result) {
$result->rank($eingabe); $result->rank($eingabe, $phrases);
} }
} }
......
Supports Markdown
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