Commit 655a0c75 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Merge branch '64-styles-fur-die-handyversion-werden-noch-nicht-korrekt-ubernommen' into 'master'

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

Closes #64

See merge request !67
parents 2ca084b0 df64d556
...@@ -105,18 +105,23 @@ class Result ...@@ -105,18 +105,23 @@ class Result
foreach(explode(" ", trim($tmpEingabe)) as $el) foreach(explode(" ", trim($tmpEingabe)) as $el)
{ {
$el = preg_quote($el, "/"); $el = preg_quote($el, "/");
if(preg_match("/\b$el\b/si", $tmpTitle)) if(strlen($tmpTitle) > 0)
{ {
$tmpRank += .7 * .6 * $maxRank; if(preg_match("/\b$el\b/si", $tmpTitle))
}elseif (strpos($tmpTitle, $el) !== false) { {
$tmpRank += .3 * .6 * $maxRank; $tmpRank += .7 * .6 * $maxRank;
}elseif (strpos($tmpTitle, $el) !== false) {
$tmpRank += .3 * .6 * $maxRank;
}
} }
if( strlen($tmpDescription) > 0 )
if(preg_match("/\b$el\b/si", $tmpDescription))
{ {
$tmpRank += .7 * .4 * $maxRank; if(preg_match("/\b$el\b/si", $tmpDescription))
}elseif (strpos($tmpDescription, $el) !== false) { {
$tmpRank += .3 * .4 * $maxRank; $tmpRank += .7 * .4 * $maxRank;
}elseif (strpos($tmpDescription, $el) !== false) {
$tmpRank += .3 * .4 * $maxRank;
}
} }
} }
$tmpRank /= sizeof(explode(" ", trim($tmpEingabe))) * 10; $tmpRank /= sizeof(explode(" ", trim($tmpEingabe))) * 10;
......
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