Related topics in [nodebb-plugin-widget-essentials] should be filterable by the category of their parent
-
I'm glad i discovered that displaying related topics is a feature of the widget-essentials plugin : Is there any plugin to show related or similar topics on topic page?
However, after adding this widget in my topic footer i was really disapointed that the suggested topics weren't really that related as they didn't belong to the same category (forum) of the post in question.
I expected the category filter of the widget to be intended just for that purpose but it doesn't work on topics pages (so what's the point ?): -
Seems like a bug, that custom category option doesn't seem to be used right now in that widget. With that said, if you place the widget on a topic page it should get the topics related to that topic. https://github.com/NodeBB/nodebb-widget-essentials/blob/master/library.js#L405.
-
Yeah that help text is just wrong, that input field has no effect. If you place that widget on a topic page it does this. https://github.com/NodeBB/NodeBB/blob/master/src/topics/suggested.js#L11-L41
It will get the topics that have the same tags as the current topic you are in(these could be from other categories) then it will search for topics with similar titles and then it will get topics from the same category. So if you are only displaying 10 suggested topics and there are 10 topics with the same tag, you won't see any topics from the same category. Maybe we could change the code a bit so it does display a mix of all three instead of prioritizing tags.
-
The problem with category filter is if you specify a category id on the widget it will only work on a single category, that's why that setting doesn't make sense. For example if you set it to cid=3 and put the widget on topic.tpl, it will only display topics from category 3 even if the topic you are looking at is in a different category. That's why we get the category id from the database by looking at the category id of the topic you are in.
I think we can improve the code by showing a mix of the 3 options(same tag, similar title, same category) instead of prioritizing tags. So essentialy we just shuffle the results.
-
Excellent work @baris (i noticed the routine maintenance screen)
Here is how i see it :
The category filter is useful in my mind : sometimes it's just what we want because results from other sections of the forum could be totally irrelevant.. (it really depends on how your forum is divided...)
If a category is given, we should be able to filter on the requested category, if not, maybe topics within the same category should just be given a higher weight to sort the requested n results..
What do you think ?