diff options
author | Jesús <heckyel@hyperbola.info> | 2020-06-10 16:11:18 -0500 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2020-06-10 16:11:18 -0500 |
commit | 9d22ec021fa2cf461e6f62fef78103493e21b2ad (patch) | |
tree | 22a3fe19ed075e2debee75ec6ac8ea1e13827246 /content | |
parent | ed201535a3f08450238ef79c6d407e0db052e785 (diff) | |
download | libretube-9d22ec021fa2cf461e6f62fef78103493e21b2ad.tar.lz libretube-9d22ec021fa2cf461e6f62fef78103493e21b2ad.tar.xz libretube-9d22ec021fa2cf461e6f62fef78103493e21b2ad.zip |
tipuesearch_content.json: update filter only articles and improved JSON API
Diffstat (limited to 'content')
-rw-r--r-- | content/pages/buscar.php.md | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/content/pages/buscar.php.md b/content/pages/buscar.php.md index accc6d8..b06a021 100644 --- a/content/pages/buscar.php.md +++ b/content/pages/buscar.php.md @@ -62,9 +62,9 @@ if (isset($_GET['q'])) { $keywords = explode(' ', $keywords); $found_results = []; - foreach ($web_content["pages"] as $page) { + foreach ($web_content["videos"] as $page) { $score = 0; - $page['text'] = htmlentities($page['text']); + $page['description'] = htmlentities($page['description']); foreach ($keywords as $word) { if (preg_match("/$word/i", $page['url'])) { @@ -78,16 +78,16 @@ if (isset($_GET['q'])) { } // It replaces uppercase matches with lowercase matches, but it's fine for now. if ($stop_words_ignored == 1) { - $page['text'] = preg_replace("/$word/i", $word, $page['text'], -1, $match_count); + $page['description'] = preg_replace("/$word/i", $word, $page['description'], -1, $match_count); } else { - $page['text'] = preg_replace("/$word/i", '<span class="tipue_search_content_bold highlighted">' . $word . '</span>', $page['text'], -1, $match_count); + $page['description'] = preg_replace("/$word/i", '<span class="tipue_search_content_bold highlighted">' . $word . '</span>', $page['description'], -1, $match_count); } if ($match_count > 0) { $score += 10 * $match_count; } } if ($score != 0) { - $found_results[] = ['score' => $score, 'title' => $page['title'], 'url' => $page['url'], 'text' => $page['text']]; + $found_results[] = ['score' => $score, 'title' => $page['title'], 'url' => $page['url'], 'description' => $page['description']]; } } @@ -123,7 +123,7 @@ if (isset($_GET['q'])) { printf('<div class="tipue_search_content_title"><a class="is-cyan" href="%s">%s</a></div>', $found_result['url'], $found_result['title']); printf('<div class="tipue_search_content_url"><a href="%s">%s</a></div>', $found_result['url'], $found_result['url']); - $description_words = explode(' ', $found_result['text']); + $description_words = explode(' ', $found_result['description']); $description_words_count = count($description_words); $first_match = false; for ($i = 0; $i < $description_words_count; $i++) { |