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

Can't seem to get tokenizer working on specific key #205

Open
simplenotezy opened this issue Jan 6, 2020 · 0 comments
Open

Can't seem to get tokenizer working on specific key #205

simplenotezy opened this issue Jan 6, 2020 · 0 comments

Comments

@simplenotezy
Copy link

simplenotezy commented Jan 6, 2020

I have troubles getting the Bloodhound tokenizer to work currently. I only want it to match on the value key in the result set, but it seems to only want to match on name key.

This is my code:

var menuResults = new Bloodhound({
	datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
	queryTokenizer: Bloodhound.tokenizers.whitespace,
	prefetch: {
		url: source + '&return_menu_items',
		cache: true
	},
	remote: {
		url: source + '&return_custom_events&q=%QUERY',
		wildcard: '%QUERY'
	}
});

This is my result set from prefetch:

[
	{
		"name": "Dashboard",
		"value": "dasssh",
		"link": "https://website.test/wp-admin/index.php",
		"icon": "<div class=\"wpib wpib-icon wpib-icon-dashboard wpib-icons-sprite\"></div>"
	}
]

Still, when I write "dass" the result does not show up. If I write "Dash" it shows up.

What am I doing wrong here?

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

1 participant