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

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

  • 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.

  • keywords only

  • 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.

    UnderDog
  • 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.

    ahmedaladdinUnderDog
  • 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?

    UnderDog
  • @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.

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

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

  • 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

  • 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
    
    ValentineMasinahgtonightperegrine
Sign In or Register to comment.