Author: Jorge Maldonado Ventura Date: 2017-04-22 20:38 Modified: 2020-06-11 11:38 Save_as: buscar.php Status: hidden Title: Resultados
0) { $score += 10 * $match_count; } } if ($score != 0) { $found_results[] = [ 'score' => $score, 'title' => $page['title'], 'time' => $page['time'], 'videoThumbnail' => $page['videoThumbnail'], 'url' => $page['url'], 'published' => $page['published'], 'publishedText' => $page['publishedText'], 'author' => $page['author'], 'authorUrl' => $page['authorUrl'], ]; } } /** * Compare results score. */ function comp_result_score($a, $b) { if ($a['score'] == $b['score']) { return 0; } return ($a['score'] > $b['score']) ? -1 : 1; }; if ($stop_words_ignored) { printf('
%s

', 'Algunas palabras «comunes» fueron ignoradas'); } $found_results_count = count($found_results); if ($found_results_count > 0) { usort($found_results, 'comp_result_score'); if ($found_results_count == 1) { $found_results_count_str = NULL; } } else if ($found_results_count == 0) { $found_results_count_str = NULL; printf('
%s
', 'No se ha encontrado nada'); } // Init head printf('
'); foreach ($found_results as $found_result) { printf(' ', $found_result['url'], $found_result['videoThumbnail'], $found_result['title'], $found_result['time'], $found_result['url'], $found_result['title'], $found_result['title'], $found_result['published'], $found_result['publishedText'], $found_result['authorUrl'], $found_result['author']); } } else { printf('
%s
', 'Aún no has buscado'); } // End head printf('
'); ?>