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

Matching data in the middle of the word #23

Closed
squareleaf opened this issue Jan 10, 2013 · 4 comments
Closed

Matching data in the middle of the word #23

squareleaf opened this issue Jan 10, 2013 · 4 comments

Comments

@squareleaf
Copy link

I would like to be able to match search terms based on the start of each word in the string, but the search currently picks up matching letters in the middle of words. For instance, when searching a short local array of album names, if I enter 'in', it matches 'incunabula' and 'run into shadows' as it should, but also matches 'fresh fruit for rottINg vegetables'. If I alter line 342, changing value.toLowerCase().indexOf(q) back to ===0 (as referenced in this issue: #1 (reference)), it only matches 'incunabula' but not 'run into shadows'. Is there a value there that will work as intended? I noticed that another site that uses this plugin achieves that effect (bisonoffice.com) but I'm not clear on how. Thanks!

@tkirda
Copy link
Member

tkirda commented Jan 10, 2013

They are using server side for suggestions. Default filter on the client side matches anywhere in the string. Now you will need to modify source. I will change it so it is possible to customize function that does the filtering.

@squareleaf
Copy link
Author

Turns out this won't be an issue for me. I was using a local array for testing purposes but will be eventually populating with JSON data. You can close the issue if you like. Sorry that I didn't clarify with my team ahead of time.

@tkirda
Copy link
Member

tkirda commented Jan 11, 2013

It's OK, i think it is good feature to have anyway.

@tkirda
Copy link
Member

tkirda commented Jan 15, 2013

Added option lookupFilter where you can specify custom logic to filter suggestions. See following commit 32857e7

@tkirda tkirda closed this as completed Jan 15, 2013
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

No branches or pull requests

2 participants