mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-30 14:57:59 +01:00
Increased the suggestions count to 10 for search fields specifically
Default 5 entries feel not enough for search field
This commit is contained in:
parent
9dd26f2f87
commit
7fa141bb54
1 changed files with 3 additions and 1 deletions
|
@ -200,10 +200,12 @@ function listenAutocomplete() {
|
|||
|
||||
if (localAc !== null && 'ac' in event.target.dataset) {
|
||||
inputField = event.target;
|
||||
let suggestionsCount = 5;
|
||||
|
||||
if (isSearchField()) {
|
||||
originalQuery = inputField.value;
|
||||
selectedTerm = getSelectedTerm();
|
||||
suggestionsCount = 10;
|
||||
|
||||
// We don't need to run auto-completion if user is not selecting tag at all
|
||||
if (!selectedTerm) {
|
||||
|
@ -216,7 +218,7 @@ function listenAutocomplete() {
|
|||
originalTerm = `${inputField.value}`.toLowerCase();
|
||||
}
|
||||
|
||||
const suggestions = localAc.topK(originalTerm, 5).map(({ name, imageCount }) => ({ label: `${name} (${imageCount})`, value: name }));
|
||||
const suggestions = localAc.topK(originalTerm, suggestionsCount).map(({ name, imageCount }) => ({ label: `${name} (${imageCount})`, value: name }));
|
||||
|
||||
if (suggestions.length) {
|
||||
return showAutocomplete(suggestions, originalTerm, event.target);
|
||||
|
|
Loading…
Reference in a new issue