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

When Tokens Include Spaces Using a Space in the Search Term Stops the Suggestions #238

Closed
xfreshy opened this issue May 13, 2013 · 3 comments

Comments

@xfreshy
Copy link

xfreshy commented May 13, 2013

I have spaces in my datums. For instance:

{ value:"apple",tokens:["apple"] }, { value:"great ape",tokens:["great ape"] }

When typing "great" the suggestion returns "great ape". But when typing "great " (with a space), no suggestions are returned.

The main issue here is that I WANT the token to HAVE a space. I don't want this behavior of typing a search like "ap" and getting "great ape" in the results.

@jharding
Copy link
Contributor

Yeah this is a limitation within the matching algorithm used by typeahead.js. In a future release I'd like to look into improving this, but that's probably a ways off.

@dukehoops-zz
Copy link

@jharding, if I wanted to override existing matching alg, what method would I look to override in typeahead.js?

-nikita
PS. Thanks for such a nice plugin

@jharding
Copy link
Contributor

Take a look at Dataset#getSuggestions (link). That function splits the query into terms and then passes those terms to Dataset#_getLocalSuggestion. Within that function is where the work is done for finding suggestions.

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

No branches or pull requests

3 participants