mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-12-02 15:48:00 +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) {
|
if (localAc !== null && 'ac' in event.target.dataset) {
|
||||||
inputField = event.target;
|
inputField = event.target;
|
||||||
|
let suggestionsCount = 5;
|
||||||
|
|
||||||
if (isSearchField()) {
|
if (isSearchField()) {
|
||||||
originalQuery = inputField.value;
|
originalQuery = inputField.value;
|
||||||
selectedTerm = getSelectedTerm();
|
selectedTerm = getSelectedTerm();
|
||||||
|
suggestionsCount = 10;
|
||||||
|
|
||||||
// We don't need to run auto-completion if user is not selecting tag at all
|
// We don't need to run auto-completion if user is not selecting tag at all
|
||||||
if (!selectedTerm) {
|
if (!selectedTerm) {
|
||||||
|
@ -216,7 +218,7 @@ function listenAutocomplete() {
|
||||||
originalTerm = `${inputField.value}`.toLowerCase();
|
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) {
|
if (suggestions.length) {
|
||||||
return showAutocomplete(suggestions, originalTerm, event.target);
|
return showAutocomplete(suggestions, originalTerm, event.target);
|
||||||
|
|
Loading…
Reference in a new issue