Commit df64d556 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Bugfix bei dem es einen Fehler während des Rankings gab

parent f3b711b6
...@@ -105,13 +105,17 @@ class Result ...@@ -105,13 +105,17 @@ class Result
foreach(explode(" ", trim($tmpEingabe)) as $el) foreach(explode(" ", trim($tmpEingabe)) as $el)
{ {
$el = preg_quote($el, "/"); $el = preg_quote($el, "/");
if(strlen($tmpTitle) > 0)
{
if(preg_match("/\b$el\b/si", $tmpTitle)) if(preg_match("/\b$el\b/si", $tmpTitle))
{ {
$tmpRank += .7 * .6 * $maxRank; $tmpRank += .7 * .6 * $maxRank;
}elseif (strpos($tmpTitle, $el) !== false) { }elseif (strpos($tmpTitle, $el) !== false) {
$tmpRank += .3 * .6 * $maxRank; $tmpRank += .3 * .6 * $maxRank;
} }
}
if( strlen($tmpDescription) > 0 )
{
if(preg_match("/\b$el\b/si", $tmpDescription)) if(preg_match("/\b$el\b/si", $tmpDescription))
{ {
$tmpRank += .7 * .4 * $maxRank; $tmpRank += .7 * .4 * $maxRank;
...@@ -119,6 +123,7 @@ class Result ...@@ -119,6 +123,7 @@ class Result
$tmpRank += .3 * .4 * $maxRank; $tmpRank += .3 * .4 * $maxRank;
} }
} }
}
$tmpRank /= sizeof(explode(" ", trim($tmpEingabe))) * 10; $tmpRank /= sizeof(explode(" ", trim($tmpEingabe))) * 10;
$rank += $tmpRank; $rank += $tmpRank;
......
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