Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Related discussions or another post

Is there anyway to add some Related discussions links after every discussion?

I remember SphinxSearch plugin does that, but currently i am using google custom search which is not limited to forum search and much better indeed.

Answers

  • Options
    hgtonighthgtonight ∞ · New Moderator

    What would determine how the discussions are related? Keywords? Tags? Author?

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options

    keywords only

  • Options
    hgtonighthgtonight ∞ · New Moderator

    Searching on keywords will require an indexing engine to get any decent results. I would look into using Sphinx.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options

    yes if you don't have the resources to run an indexer like sphinx you will kill you server running myslq queries to do this. Pointless.

    if it was tags, you could do that a bit more realistically.

    grep is your friend.

  • Options

    Can I use Sphinx only for the purpose of related discussion and disable the search feature which have already been replaced by google custom search?

  • Options

    @ahmedaladdin said:
    Can I use Sphinx only for the purpose of related discussion and disable the search feature which have already been replaced by google custom search?

    You can but as it will index anyway there wouldn't be much point, I suppose google offers some advantages, but as sphinx indexes the database, it is more accurate generally.

    grep is your friend.

  • Options

    Why don't you make a small tag cloud for those discussions? All discussions with the same tags are related, right?

    There was an error rendering this rich post.

  • Options

    Good idea @underdog, but it is easier and looks better for users if they see related discussions as given in sphinx

  • Options

    How can I implement a related discussions by tags after every discussion? I will need the discussions to have a limit of about 6 discussions. If tags are hard to implement I may take categories to do that. After discussion will have a related discussion list with 6 previous posts links from the same category. Any suggestions? Thanks a lot for taking time to view this question

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    You would have to write a plugin, but I guess you knew that already ;)

    I do not like "related" views so I might get it wrong, but I guess I would start by fetching what I think is related based on the tags like that:

    $Sql = Gdn::SQL();
    
    // Get all Tags of one discussion
    $TagIDs = $Sql->Select('TagID')
        ->From('TagDiscussion')
        ->Where('DiscussionID', $DiscussionID)
        ->Get()
        ->ResultArray();
    
    $DiscussionIDs = $Sql->Select('DiscussionID')
        ->Select('DiscussionID', 'count', 'DiscussionIDCount')
        ->From('TagDiscussion')
        ->WhereIn('TagID', ConsolidateArrayValuesByKey($TagIDs, 'TagID'))
        ->OrderBy('DateInserted', 'desc')
        ->OrderBy('DiscussionIDCount', desc) // don't think this will work 
        ->Limit(C('Plugins.Related.Limit', 5)) // skip this if above doesn't work
        ->Get()
        ->ResultArray;
        // if "OrderBy" above is not working, you would have to do an array sort
    
Sign In or Register to comment.