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

match hyphens in tags search on /tags with JS Typeahead library #6347

Closed
jywarren opened this issue Sep 27, 2019 · 3 comments · Fixed by #6379
Closed

match hyphens in tags search on /tags with JS Typeahead library #6347

jywarren opened this issue Sep 27, 2019 · 3 comments · Fixed by #6379
Labels
bug the issue is regarding one of our programs which faces problems when a certain task is executed help wanted requires help by anyone willing to contribute JavaScript

Comments

@jywarren
Copy link
Member

We made some changes so that the tags search form now searches for hyphenated tags even if you input a string with spaces. For example, searching for:

balloon map actually sends a search for balloon-map and so it matches the tag balloon-mapping correctly.

However, although results are sent back from the server for this search, these results are not displayed. That's because our typeahead library tries to do a second comparison of the results with the typed input, and balloon map doesn't match balloon-mapping, and so nothing is shown.

The code driving this is here:

el.find('.control-group .help-block').remove();
el.find('.control-group').append('<span class="help-block">' + response.responseText + '</span>')
});
setupTagDelete($('.tag-delete'));
el.find('.tag-input').typeahead({
items: 8,
minLength: 3,
source: function (query, process) {
return $.post('/tag/suggested/' + query, {}, function (data) {
return process(data);
})
},

And our library offers a range of options; i think the matcher function could be provided to substitute the hyphens in in local JavaScript, to allow matches with the results:

https://github.com/bassjobsen/Bootstrap-3-Typeahead#options

But it will take some experimentation to get this working! We'd love help with this. Thanks! 🎉

(linking to #5719)

@jywarren jywarren added bug the issue is regarding one of our programs which faces problems when a certain task is executed help wanted requires help by anyone willing to contribute JavaScript labels Sep 27, 2019
@jywarren jywarren added this to the Tagging and topics milestone Sep 27, 2019
@jywarren
Copy link
Member Author

Screenshot of watching the results return and not match!

image

@moki298
Copy link
Contributor

moki298 commented Oct 1, 2019

I am claiming this, will update on this asap, currently I am setting up the environment for this.

@moki298
Copy link
Contributor

moki298 commented Oct 3, 2019

@jywarren This has been fixed, please check #6379

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug the issue is regarding one of our programs which faces problems when a certain task is executed help wanted requires help by anyone willing to contribute JavaScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants