What happened just before the problem occurred? Or what problem could this idea solve?
Not quite a bug, but more of an observation that I didn't realize was limiting the results I'd see when using the search bar: when previously searching for mapping content, I entered mapping
into the search bar, and that tag didn't appear in the autosuggested list of tags (see screenshot). But today I saw the mapping
tag on a post and clicked on it, and saw from the tag page that there's quite a lot of content there tagged with mapping
!
What did you expect to see that you didn't?
I expected to see mapping
appear in the autosuggested list of tags as an exact match when entering that term into the search bar, given that the mapping
tag page exists and there's lots of content attached to that tag.
Existing content with the mapping
tag: https://publiclab.org/tag/mapping
bhamster
Thanks for opening your first issue! This space is protected by our Code of Conduct - and we're here to help.
Please follow the issue template to help us help you 👍🎉😄
If you have screenshots or a gif to share demonstrating the issue, that's really helpful! 📸
Do join our Gitter channel for some brainstorming discussions.
Hi @bhamster07 thank you for a very clearly documented observation and idea! ✨
I'm going to try to tease out some details here to help. My questions:
OK, so to 1) i see this endpoint where we're responding to autocompletion: https://publiclab.org/tag/suggested/mapping (only accessible via JavaScript):
Note this is different from the tag autocompletion in the search box on https://publiclab.org/tags, which is from this segment of code.
As to 5) i want to cautiously say the only other place we're using this code is on https://publiclab.org/search/tags
I think that means we could insert the exact match at the top of the list in this deeper API code:
I'd like also to write a functional test for this to confirm that the top match is the exact match. I think this would be based on this test, and follow it, using an entire word like "spectrometer":
This is great because for the partial match we'd still see this ordering:
But in the exact match we'd see items 1 and 2 swap places. That should be a great and specific test.
I want to propose adding this to the Tagging project for our combined Outreachy and GSoC teams! cc @17sushmita @Manasa2850 (more soon on how your project plans may overlap! 🎉)
Thanks so much for building this issue out with all these details @jywarren ! 😄
Most helpful comment
Hi @bhamster07 thank you for a very clearly documented observation and idea! ✨
I'm going to try to tease out some details here to help. My questions:
OK, so to 1) i see this endpoint where we're responding to autocompletion: https://publiclab.org/tag/suggested/mapping (only accessible via JavaScript):
https://github.com/publiclab/plots2/blob/158fadc6ed12b66bd0b17f65a134cef59b81cfee/app/controllers/tag_controller.rb#L394-L401
Note this is different from the tag autocompletion in the search box on https://publiclab.org/tags, which is from this segment of code.
As to 5) i want to cautiously say the only other place we're using this code is on https://publiclab.org/search/tags
I think that means we could insert the exact match at the top of the list in this deeper API code:
https://github.com/publiclab/plots2/blob/158fadc6ed12b66bd0b17f65a134cef59b81cfee/app/services/search_service.rb#L79-L91
I'd like also to write a functional test for this to confirm that the top match is the exact match. I think this would be based on this test, and follow it, using an entire word like "spectrometer":
https://github.com/publiclab/plots2/blob/3a05ae2d547c71d5a7d173741586397947fcbc00/test/functional/tag_controller_test.rb#L435-L440
This is great because for the partial match we'd still see this ordering:
https://github.com/publiclab/plots2/blob/3a05ae2d547c71d5a7d173741586397947fcbc00/test/functional/tag_controller_test.rb#L439
But in the exact match we'd see items 1 and 2 swap places. That should be a great and specific test.
I want to propose adding this to the Tagging project for our combined Outreachy and GSoC teams! cc @17sushmita @Manasa2850 (more soon on how your project plans may overlap! 🎉)