Hello, please find below two little glitches in the search algorithm I recently found.
How to reproduce the first issue? In the search bar, if you type the word craft then 25 results from the HackTheBox - Craft video should appear. Now please only type the letter q then erase it with the backspace key. When you type the word craft again then... no result is found!
How to fix the first issue? I added in logic.js the line currentSet = window.dataset; located in the if/else statement of the doSearch function. When the variable val is an empty string, if the results are reset, the issue seems to be fixed. I also added the line noResults.style.display = 'none'; in order to remove the "try being more specific" message when the search bar becomes empty.
How to reproduce the second issue? In the search bar, if you type the word terminal then 7 results should appear to this day. Now please only erase the letter m with the backspace key: terinal returns zero results, which is fine. However, if you type again the letter m and then search for terminal again... no result will be found!
How to fix the second issue? I removed in logic.js the if (val.length < oldSearchValue.length) statement also located in the doSearch function. If you try to reproduce this issue by adding or removing letters in your search terms, it should return results.
Hello, please find below two little glitches in the search algorithm I recently found.
How to reproduce the first issue? In the search bar, if you type the word
craft
then 25 results from the HackTheBox - Craft video should appear. Now please only type the letterq
then erase it with the backspace key. When you type the wordcraft
again then... no result is found!How to fix the first issue? I added in
logic.js
the linecurrentSet = window.dataset;
located in the if/else statement of the doSearch function. When the variableval
is an empty string, if the results are reset, the issue seems to be fixed. I also added the linenoResults.style.display = 'none';
in order to remove the "try being more specific" message when the search bar becomes empty.How to reproduce the second issue? In the search bar, if you type the word
terminal
then 7 results should appear to this day. Now please only erase the letterm
with the backspace key:terinal
returns zero results, which is fine. However, if you type again the letterm
and then search forterminal
again... no result will be found!How to fix the second issue? I removed in
logic.js
theif (val.length < oldSearchValue.length)
statement also located in the doSearch function. If you try to reproduce this issue by adding or removing letters in your search terms, it should return results.