IndexPostList and Blog Post Comments

IndexPostList and Blog Post Comments

This question is answered

We currently display an IndexPostList on our member profile page that lists the user's activity on the site. I just noticed that it doesn't display blog post comments. Doing some research the individual blog post page is using a CSBlog:WeblogFeedbackList however that control appears to operate on the active post (haven't dug through the code yet).

My question is whether:

a - I'm being an idiot and there's something obvious that I'm missing
b - I'm not being an idiot, it's something kind of obscure that I'm missing
c - There currently isn't a control that I can use for this purpose and I'll have to write my own

The ideal solution would be one that would search every blog post on the site that the current user has visibility for (would include public group post comments but not private group post comments where the current user isn't a member).

I'm guessing I'm not the first to wonder about the blog post comments issue and someone has probably address this already. That said my searching the forums isn't turning up anything.

Verified Answer
  • Comments (Blog or Media Gallery) aren't indexed by CS.  They were in early versions of CS2007 however there were a lot of complaints so the functionality was removed.

    In order to index posts, you're looking at creating a new WeblogDataProvider, which derrives from CommunityServer.Data.WeblogSqlDataProvider, and overriding the SearchReindexPosts method.  This method should contain the same contents as the base SearchReindexPosts, but you should use the folowing for setting the query's BlogPostType

       query.BlogPostType = BlogPostType.Post | BlogPostType.Article | BlogPostType.Comment | BlogPostType.PersonalComment;

    You'll then need to edit the WeblogDataProvider entry in communityserver.config to point to your custom class.

    Once that's on your website, give it a few hours for the search index job to run and index all the comments and comments should start appearing in search queries.

     

    You could do this by directly editing the SDK, but this extension method can be done without editing any core code making upgrading easier - you don't even have to edit communityserver.config directly as you can do that through a communityserver_override.config file.

All Replies
  • Comments (Blog or Media Gallery) aren't indexed by CS.  They were in early versions of CS2007 however there were a lot of complaints so the functionality was removed.

    In order to index posts, you're looking at creating a new WeblogDataProvider, which derrives from CommunityServer.Data.WeblogSqlDataProvider, and overriding the SearchReindexPosts method.  This method should contain the same contents as the base SearchReindexPosts, but you should use the folowing for setting the query's BlogPostType

       query.BlogPostType = BlogPostType.Post | BlogPostType.Article | BlogPostType.Comment | BlogPostType.PersonalComment;

    You'll then need to edit the WeblogDataProvider entry in communityserver.config to point to your custom class.

    Once that's on your website, give it a few hours for the search index job to run and index all the comments and comments should start appearing in search queries.

     

    You could do this by directly editing the SDK, but this extension method can be done without editing any core code making upgrading easier - you don't even have to edit communityserver.config directly as you can do that through a communityserver_override.config file.

  • Yes, it nice and easy now..