Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Case-Insensitive keyword matching #7
In case anybody cares, I was able to easily implement "case insensitive" search feature by simply changing one line of code.
I changed this:
to instead make use of "contains", like this:
I also went a step further and limited my output results to only 6 suggestions max, like so:
So now, I am able to apply my keyword to search for a pattern within the entire string, not just from the beginning of the string. This replicates the standard jQuery Autocomplete behaviour, in case you are migrating to this accessible version from that instead.
Hi @Devtr0n !
Yes, I'm interested :)
For the case insensitive, it was already available, see data-combobox-case-sensitive="yes/no" in the doc http://a11y.nicolas-hoffmann.net/autocomplet-list/#plugin-options
But for the search within the entire string, that is a really good idea, I'm going to add it based on your suggestion (as an option). Good point too for the search result limit.
One question : how did you implement the "See more results" option? Is there an URL I can test it?
Thanks a lot for your suggestions and work
In the $body.on event listener, I appended the "See more results..." as the last suggestion, like so:
and then in my click handler, I handle it, like so
^ This basically checks if the user selected "See more results...", and if that's true, it uses the "data-lastval" attribute, to append to the search URL.
My search page will handle the keyword submission to the data controller/database.
Also, the reason we limit our auto-suggestions to 6, is because we can get 100's of suggestions in certain situations. Out of the box, the jQuery AutoComplete UI control has a limit size on it.
For instance, if someone were looking for "community" as in "community college" they would see several hundred, like so (see that scroll bar?? ) :
I also use JSON to load my suggestions list, instead of raw HTML/option tags.
Here is my HTML:
Here is my document ready function:
Hi @Devtr0n ,
it took some time (not much free time), but I added the options to the plugin :)
The only one I didn't set up (too specific) is the JSON loading. However, it is really interesting seeing other ideas.
The doc is updated: http://a11y.nicolas-hoffmann.net/autocomplet-list/
Thanks a lot for all your suggestions, really appreciated.