I use Select2 in my app to allow for searching a dropdown with about 1200 options.
I am currently making use of the default implementation of Select2's matcher, which works well as long as keywords are adjacent in the search results:
function(term, text) { return text.toUpperCase().indexOf(term.toUpperCase())>=0; }
For example, a search for 'stackoverflow question' returns option 'Stackoverflow question about Select2'
I would however else like the matcher to return results based on non-adjacent keywords. For instance, I would also like it to return the above option when searching for 'stackoverflow select2'.
Would anyone have an idea how to create a custom matcher to allow for this behavior?