diff options
author | Jesús <heckyel@hyperbola.info> | 2020-06-13 19:43:09 -0500 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2020-06-13 19:43:09 -0500 |
commit | 669b9c43fa06434f25d82de8e70c4fcfd4bc7805 (patch) | |
tree | ea14d106b8b4d65af6cc68822427beb4113cb421 /content | |
parent | df45d91a9c31245955f6eeca30f84263d3705ad8 (diff) | |
download | libretube-669b9c43fa06434f25d82de8e70c4fcfd4bc7805.tar.lz libretube-669b9c43fa06434f25d82de8e70c4fcfd4bc7805.tar.xz libretube-669b9c43fa06434f25d82de8e70c4fcfd4bc7805.zip |
Fix category and tags for search
Diffstat (limited to 'content')
-rw-r--r-- | content/pages/buscar.php.md | 8 |
1 files changed, 7 insertions, 1 deletions
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. |