Skip to content
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

Hoist exact matches to top of autocomplete suggestions #486

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

user24
Copy link

@user24 user24 commented May 30, 2016

For query "Bee", with data:

var suggestions = [{
    "value": "beetle"
},{
    "value": "beezlebub"
},{
    "value": "bee"
},{
    "value": "beet"
}]

Used to suggest:

beetle
beezlebub
bee
beet

now suggests:

bee
beetle
beezlebub
beet

Could be improved further but it's better than no sorting.

@user24
Copy link
Author

user24 commented May 30, 2016

Would actually be better to allow people to supply their own sort function, with something like this as the default, imho.

@tkirda
Copy link
Member

tkirda commented Jun 2, 2016

You can actually provide your own lookup function where you can filter and sort results anyway you want.

Also it would make sense that sort function can be provided via options and optional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants