buscar.php: fix skip "common words"

This commit is contained in:
Jesús 2020-06-11 16:13:49 -05:00
parent 34e67e3407
commit b12d5e3c6e
No known key found for this signature in database
GPG Key ID: F6EE7BC59A315766

View File

@ -5,10 +5,7 @@ Save_as: buscar.php
Status: hidden
Title: Resultados
<main class="row main-videos">
<div class="col-md-12">
<div class="row">
<?php
$STOP_WORDS = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
'ñ', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
@ -114,10 +111,12 @@ if (isset($_GET['q'])) {
return ($a['score'] > $b['score']) ? -1 : 1;
};
$stop_results = $found_results;
if ($stop_words_ignored) {
printf('<div id="tipue_search_warning">%s</div>', 'Las palabras comunes se ignoran en gran parte');
$stop_results = NULL;
printf('
<div class="col-md-12 text-justify">
<h6 class="tab">%s</h6>
<hr>
</div>', 'Algunas palabras «comunes» fueron ignoradas');
}
$found_results_count = count($found_results);
@ -132,7 +131,10 @@ if (isset($_GET['q'])) {
printf('<div id="tipue_search_warning">%s</div>', 'No se ha encontrado nada');
}
if (!empty($stop_results)) {
// Init head
printf('
<div class="col-md-12">
<div class="row">');
foreach ($found_results as $found_result) {
printf('
<article class="col-md-3 video" itemscope itemtype="https://schema.org/Movie">
@ -176,12 +178,12 @@ if (isset($_GET['q'])) {
$found_result['title'], $found_result['published'], $found_result['publishedText'],
$found_result['authorUrl'], $found_result['author']);
}
}
} else {
printf('<div id="tipue_search_warning">%s</div>', 'Aún no has buscado');
}
// End head
printf('</div>
</div>');
?>
</div>
</div>
</main>