Fix category and tags for search

This commit is contained in:
Jesús
2020-06-13 19:43:09 -05:00
parent df45d91a9c
commit 669b9c43fa
2 changed files with 14 additions and 2 deletions

View File

@@ -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.