Related topics in [nodebb-plugin-widget-essentials] should be filterable by the category of their parent
zipang last edited by zipang
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.
@baris Well.. it's not !
It seemed like a bug to me too.. at least, not what i expected.
Then i noticed the mention :
If placed on a page other than categoy will pull from all recent posts
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.
@baris Thnxx for your explanation ! I got it now : the
I almost agree with the priority given to tag matching over titles matching..
But what is clearly missing is the category filter !
@baris But yes.. you're right : there should be a better way to do this by matching topics on tags and titles at the same time, with some ponderation.. and with a category filter if given...
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.
I changed the code a bit so now it searches in the same category and shuffles the results. https://github.com/NodeBB/NodeBB/commit/9d3b00f77855cacb96ac90abd3f5bbb5f2b5bc97
zipang last edited by zipang
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 ?
If we look at the newly Suggested Topics on bottom of this post.. they don't really seem to be particularly relevant to our discussion
That's correct, yet they are all from the same
Awesome @baris : i should have a look at your changes !
I think we should be able to display more relevant topics by sorting the results with a good mixed ponderation...