Radi Atanassov

SharePoint MCM, MVP, MCT and owner of OneBit Software

Getting search to show search results for social tags and the SocialTagId managed property

 

The SharePoint 2010 “My Profile” page provides some cool social tagging features that intertwine with Search, Managed Metadata and obviously the User Profile Service.

If you click the “Tags and Notes” link you will see a summary of social activity related to the user:

  

You can refine a tag for the particular user, but one functionality that not many people know of is the “Tag Profile” page. You can reach it either from the Tag Cloud Web Part, or clicking on one of the tags in the tag feed on the profile page (see my hot pink arrow in the image above).

You will eventually reach a page with a URL like “…../mysites/tagprofile.aspx?termid=bfcb16ea-cb44-46c4-b8f2-6da2646262c0” and it will look like this:

 

 

What might not seem so obvious to everyone is that the profile page says there are “no available items tagged with…” yet we reached this exact page by seeing what’s tagged by our user :) A bit silly, but there is a technical explanation. The “Tags and Notes” page feeds data from User Profiles social data, while the tag profile requires Search.

 

Now, another extremely obscure link and functionality… the text says “To find content related to ‘[Term]’ in search, please click here.” Well, OK, I think this is the only place I’ve ever seen this link or at least I can’t remember any other places at the moment. Clicking it takes us to some very interesting functionality:

 

 

It will take you to the search center configured in UPA; SocialTagId:"bfcb16ea-cb44-46c4-b8f2-6da2646262c0" will be the search keyword. The syntax suggests that “SocialTagId” is a managed property. Many environments don’t have this particular functionality configured and there is a lot of misinformation on how to configure it.

So here is what you really need to do to get this working in SharePoint 2010:

1) Make sure User Profiles, Search and Managed Metadata are all up and running. You don’t need User Profile sync.

2) Make sure the My Site Host is configured in the farm and:

a. The User Profiles Service Application is configured with the My Site Host url:

 

 

b. The web application containing the My Site Host is added as an “sps3” (or “sps3s”) start address in a content source:

 

 

HINT: create a separate content source for People data so it is more manageable and you could create separate crawl schedules

 

c. The search crawl account (aka Default Content Access Account) has read permissions on the My Site Host. The easiest way to achieve this is through a web application policy:

 

 

3) Configure the search crawl account to have permissions over User Profiles. This step is a bit tricky, you have to click the Administrators ribbon button when your UPA is selected:

 

 

You need to give the account the following two permissions:

· Retrieve People Data for Search Crawlers

· Manage Social Data

 

 

NOTE: this post by Steve Peschka explains why:http://blogs.technet.com/b/speschka/archive/2010/02/22/why-do-i-get-an-access-denied-error-when-managing-user-contexts-in-sharepoint-2010.aspx

NOTE2: Yes, I am using my farm account to crawl content. You don’t need to do this and you shouldn’t, but this is how my demo environment is set up for simplicity.

4) Create some content and tag it with some keywords. To be honest I am not 100% sure this is actually required, but this is generally true for search – it must have content to find its crawled properties before you can elevate them to managed properties.

5) Run the User Profile Social Data Maintenance job:

Get-SPTimerJob | ? {$_.TypeName -match "socialdatamaintenance"} | Start-SPTimerJob

6) Run a crawl that will capture the content you tagged

If everything is OK and the galaxies are well aligned, you will see successful logs in the content source logs:

 

 

(Actually, you might see the above if it hasn’t worked either!)

Then your Tag Profile page will look like this:

 

 

And clicking the tiny “search” link will show you results from Search J The search URL will look like this:

/search/results.aspx?k=SocialTagId%3A%22cc725510-7468-4342-80d6-5c1c9fb27180%22

 

So you may wonder, why would you need this, it doesn’t look that flashy? Well.. You can now query for items with certain tags using search. You can use this in custom rollup functionality scenarios like I need to do in one of my projects. Cool.

Hope this helps someone out!