While refactoring my company’s website, I have decided to incorporate a blog application that includes commenting. As has been mentioned numerous times here in these forums, I am including the blog posts and comments in the same table, which has proven to be an excellent solution.
I have been using the suggestions here for retrieving the comments for the posts.
I want to make the assumption that comments that are 3 to 4 levels deep on a given blog post (parent) would venture far enough off topic to be irrelevant. Therefore, using the application to limit the depth of the tree branch at, say a depth of 4 levels, seems to make sense. This all stems from the fact that the query for retrieving the path to the root, in the case of r937’s query, is limited to 4 levels.
I know I can add more nodes to the query, but what would be best practices in this situation? Should I write the query to grab a branch with, say a max of 5 nodes and use the application to restrict posting more than 5 levels deep, or would that be too limiting for commenting?
I have seen other table schemas that allow for threaded commenting n levels deep, but storing the hierarchal data in the same table (posts and comments) is so simple that I don’t really want to abandon that model. At the same time, I don’t want to be overly restrictive.