Plots2: match hyphens in tags search on /tags with JS Typeahead library

Created on 27 Sep 2019  ·  3Comments  ·  Source: publiclab/plots2

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:

https://github.com/publiclab/plots2/blob/cba54993c9e42dd10c7ecb58be45f33a6f4335c4/app/assets/javascripts/tagging.js#L73-L86

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)

JavaScript bug help wanted

All 3 comments

Screenshot of watching the results return and not match!

image

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

@jywarren This has been fixed, please check #6379

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RuthNjeri picture RuthNjeri  ·  3Comments

ebarry picture ebarry  ·  3Comments

grvsachdeva picture grvsachdeva  ·  3Comments

first-timers[bot] picture first-timers[bot]  ·  3Comments

divyabaid16 picture divyabaid16  ·  3Comments