publiclab / plots2

a collaborative knowledge-exchange platform in Rails; we welcome first-time contributors! :balloon:
https://publiclab.org
GNU General Public License v3.0
957 stars 1.83k forks source link

Add 'tag.related_tags' function to return 5-10 tags most commonly used with this one #3143

Closed jywarren closed 6 years ago

jywarren commented 6 years ago

We'd like to try to show related tags on each /tag/_____ page, based on what other tags are most often used alongside. (building off of #3064 and #13)

This could, in code, be something like:

A tag.related method in https://github.com/publiclab/plots2/blob/master/app/models/tag.rb :

Then, on our tag page template:

However, if we find this is too slow to do for every page load, we could cache the result weekly... or start to restrict it to only the past year, or limit to a maximum of 100 or 500 node_tags

derek-allen commented 6 years ago

I'd like to give this a shot if that's okay?

derek-allen commented 6 years ago

I've got a working prototype for this feature committed here https://github.com/derek-allen/plots2/commit/2b5a25b29d3f72cd8d23a3d68d6b7b34dfb5fbde

This caches related tag results for a week the first time it is called.

I'm not sure where and how exactly the related tags should be displayed exactly so I put them here in its own partial. I'd like to use the same partial that's part of the logic driving the sidebar tags, but its highly coupled to the relationships defined in node_tag, though if you want to keep the functionality the same as the sidebars, I can try to generalize it for both cases.

Let me know which direction I should take this. Thanks!

prototype-related-tags

jywarren commented 6 years ago

Oh wow! Please open a PR, this looks really good!

On Thu, Jul 26, 2018, 10:16 PM Derek Allen notifications@github.com wrote:

I've got a working prototype for this feature committed here derek-allen@ 2b5a25b https://github.com/derek-allen/plots2/commit/2b5a25b29d3f72cd8d23a3d68d6b7b34dfb5fbde

This caches related tag results for a week the first time it is called.

I'm not sure where and how exactly the related tags should be displayed exactly so I put them here in its own partial. I'd like to use the same partial that's part of the logic driving the sidebar tags, but its highly coupled to the relationships defined in node_tag, though if you want to keep the functionality the same as the sidebars, I can try to generalize it for both cases.

Let me know which direction I should take this. Thanks!

[image: prototype-related-tags] https://user-images.githubusercontent.com/40677825/43297616-08796d46-9118-11e8-8879-25a4e40cdd35.png

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/3143#issuecomment-408290696, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJ50K_vj89Epu8C8PjTN0XWdxlZNjks5uKnfkgaJpZM4VdbgZ .