SharePoint 2010 Add rating stars to Content By Query WebPart xsl style (CQWP)

There is a good post about it at http://geeksthenewblack.wordpress.com/2010/10/29/show-rating-stars-in-the-content-query-web-part/ and that is how I started.

But there is a gap. You need to do two additional steps to display stars in your Content Query WebPart.

STEP 1:

Export WebPart and edit  it in Editor. I spent lots of time finding what column and column type I need. I was trying Decimal, Number, it did not work. Finally I looked for AverageRating column in C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14TEMPLATEXMLfldtypes_SPRatings.xml – there is actually field type : AverageRating

<property name=”CommonViewFields” type=”string”>AverageRating,AverageRating;</property>

STEP 2:

Import your modified webpart file and edit it, you need to look at slots, under Presentation > Fields to display, assuming you used xsl style from mentioned blog post, you should have Ratings slot there, you need to map it to Rating (0-5);

When you save your webpart, it should include stars:

Don’t be surprised if you don’t see stars straight away. You should first make sure that your pages have rating. If you just rated them minute ago, rate calculation may not finish yet, it runs every hour on the server. Go to the page ans see if you see rating. In my case, I have Enterprise Wiki pages but you can rate any content in SharePoint 2010. To speed up the process, if you have access to your Server Central Administration, you could trigger rating calculation.

Ratings works with the help of the two timer jobs :

  • User Profile Service – Social Data Maintenance Job
  • User Profile Service – Social Rating Synchronization Job

These two timer jobs are responsible for synchronizing rating values between the Social Database and the Content Database. By default it’s configured on hourly interval. Change the interval to desired minutes will allow the timer job run more frequently and synchronize the rating data quickly. You can also trigger this jobs to run immediately for testing purposes

2 Responses to “SharePoint 2010 Add rating stars to Content By Query WebPart xsl style (CQWP)”

  1. Dhaval Shah

    Hi,
    Nice Article !
    If you want to add rating to the search results in sharepoint FAST search 2010 here is a good article…

    http://kalashnikovtechnoblogs.blogspot.in/2012/03/add-rating-stars-to-search-results.html

    Reply
  2. GKM

    Hi,
    Great post.. is there a way to have the stars clickable and interactive to enable rating in cqwp?

    Please help me on this..

    Many Thanks..

    Reply

Leave a Reply