这是indexloc提供的服务,不要输入任何密码
Skip to content

Disable searchResultLimit by default #1315

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Conversation

fritzmg
Copy link

@fritzmg fritzmg commented Jun 29, 2025

Description

I got confused when using some of the default settings of Choices.js plus searchEnabled: true that I could not find entries via the search in larger selects, unless I typed in more letters of the entry that I was looking for. So for example if I typed the letter a, it did not show all entries with that letter.

The reason for this is that the default searchResultLimit is set to 4:

searchResultLimit: 4,

However, this does not make much sense to me as by default the renderChoiceLimit is set to -1

renderChoiceLimit: -1,

i.e. Choices.js will always show all entries of the <select>. But when searching for something - which would already filter down the entries to less or equal than all - the result is suddenly limited to 4.

So I think it makes sense that the default for searchResultLimit should always be the same as renderChoiceLimit.

Generally I am not sure what the use-case is for having a searchResultLimit that is lower than the renderChoiceLimit.

Types of changes

  • Chore (tooling change or documentation change)
  • Refactor (non-breaking change which maintains existing functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

I think this constitutes a breaking change because if someone configured a renderChoiceLimit because they have a lot of <option>s and they did not set a searchResultLimit, they would suddenly potentially get more search results than their renderChoiceLimit.

Checklist

  • My code follows the code style of this project.
  • I have added new tests for the bug I fixed/the new feature I added.
  • I have modified existing tests for the bug I fixed/the new feature I added.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@Xon Xon self-requested a review July 9, 2025 14:38
@Xon Xon added the breaking change Pull request that introduces a breaking change label Jul 9, 2025
@Xon
Copy link
Collaborator

Xon commented Jul 9, 2025

@fritzmg the limit is because the fuzzy search options give increasingly inaccurate results as the result sets grows, and provides some performance savings when the list of rendering items gets large enough.

@Xon Xon closed this Jul 9, 2025
@fritzmg
Copy link
Author

fritzmg commented Jul 9, 2025

But the list can never be larger than renderChoiceLimit, can it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Pull request that introduces a breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants