Fix category and tags for search
This commit is contained in:
@@ -65,6 +65,9 @@ if (isset($_GET['q']) && !empty($_GET['q'])) {
|
||||
$score = 0;
|
||||
$page['description'] = htmlentities($page['description']);
|
||||
|
||||
// convert keyworks_tags to strings
|
||||
$tags = implode(", ", $page['keywords']);
|
||||
|
||||
foreach ($keywords as $word) {
|
||||
if (preg_match("/$word/i", $page['url'])) {
|
||||
$score += 35;
|
||||
@@ -72,7 +75,10 @@ if (isset($_GET['q']) && !empty($_GET['q'])) {
|
||||
if (preg_match("/$word/i", $page['title'])) {
|
||||
$score += 35;
|
||||
}
|
||||
if (preg_match("/$word/i", $page['tags'])) {
|
||||
if (preg_match("/$word/i", $tags)) {
|
||||
$score += 35;
|
||||
}
|
||||
if (preg_match("/$word/i", $page['category'])) {
|
||||
$score += 30;
|
||||
}
|
||||
// It replaces uppercase matches with lowercase matches, but it's fine for now.
|
||||
|
||||
Reference in New Issue
Block a user