Simplest way to implement relevance ordering for search results using tags?

Hello! I set up my first instance of Discourse a few weeks ago, using the Fakebook theme to adapt Discourse for use as a niche social media platform. I’ve been playing around with plugins and really enjoying the development process. It’s an awesome tool, thank you everyone who has created this.

I use post tagging extensively to determine which posts are relevant to which users. I have three tag groups, and posts are either auto-tagged or manually tagged with at least one tag from each group, so at least three tags per post. Users have a settings page where they can choose which tags are of particular interest to them.

In the main feed, I would like to show users all posts, and I would like posts with more of the users’ preferred tags to show up higher in the feed. So, if a post has three of the user’s preferred tags, it would show up higher in the feed for that user than a post with only two of their preferred tags. This can be “fuzzy”, and ideally, it would be great if this integrated with any search. In other words, whenever a user does a search, search results with their preferred tags are “boosted” and show up closer to the top, with more tags providing a stronger boost.

My thought is that a simple way to implement this would be to create a plugin that assigns a text code to each tag, and when a topic is given a tag, the plugin appends the text code in the body of the first post, in a hidden div. Then, I could auto-append the text codes for the user’s preferred tags to all searches. If this would work the way I’m thinking, it could allow the preferred tags to influence search relevance without modifying the core search functionality.

For folks on here with experience developing in Discourse, do you have other suggestions for better ways to implement this? And, do you think the idea with the text codes would work?

Thank you very much!

2 Likes

Thanks @codinghorror for correctly categorizing this. I wasn’t sure if “feature” included plugin development.