diff --git a/index.php b/index.php index b5fbaa5..87d65a3 100644 --- a/index.php +++ b/index.php @@ -53,7 +53,9 @@ if (isset($_GET['q']) && preg_replace('/\s+/', '', $_GET['q']) != '') { while ($row = $stmt->fetch()) { $score = 0; foreach ($terms as $param) - $score = $score + substr_count(strtolower($row['content']),strtolower($param)); + $score = $score + 100*(substr_count(strtolower($row['content']),strtolower($param)) / strlen($row['content'])); + $score = $score + 5000*(substr_count(strtolower($row['url']),strtolower($param)) / strlen($row['url'])); + $score = $score + 3000*(substr_count(strtolower($row['title']),strtolower($param)) / strlen($row['title'])); array_push($scores, $score); $row['score'] = $score; array_push($rows, $row); @@ -70,12 +72,12 @@ if (isset($_GET['q']) && preg_replace('/\s+/', '', $_GET['q']) != '') {