From 669b9c43fa06434f25d82de8e70c4fcfd4bc7805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs?= Date: Sat, 13 Jun 2020 19:43:09 -0500 Subject: Fix category and tags for search --- content/pages/buscar.php.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'content') diff --git a/content/pages/buscar.php.md b/content/pages/buscar.php.md index 5443e89..e9de76a 100644 --- a/content/pages/buscar.php.md +++ b/content/pages/buscar.php.md @@ -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. -- cgit v1.2.3