6

I am using a managed metadata column in a content type. The content type is used across the site collection.I want to show the most used values of the column as a Tag cloud web part.

The out of box Tag cloud webpart can be used only for social tags and so it does not solve my purpose.

Any idea how this can be done. I want to develop my own tag cloud webpart.

Update : I need to build tag cloud that should be capable to aggregate tags from multiple site collections in a web application

1
  • I found a tag cloud example at metadatawebpart.codeplex.com but it displays tags only from a list and not all sites in site collections
    – SP.NET
    Apr 12, 2012 at 5:31

5 Answers 5

3
+50

If you have Fast Search installed, you can build a powerful tag cloud using deep refiners. For details, Please check the post below:

http://extreme-sharepoint.com/2012/04/10/sharepoint-tag-cloud-deep-refiners-fast-search/

The tag cloud described in this post can aggregate data from a wide variety of content sources and not just the site collection. It also gives you an idea how you can have the page to display all tagged items when you click a tag in tag cloud.

6
  • The idea is amazing, however I don't have Fast search in the current farm I am working.Can we do it with SharePoint Enterprise Search?
    – SP.NET
    Apr 18, 2012 at 5:30
  • You can achieve the expected result only by using Deep Refinement- a feature found only in Fast Search. Apr 18, 2012 at 7:08
  • Ok,I have requested to enable Fast search in my farm. I will try to implement your solution then.
    – SP.NET
    Apr 18, 2012 at 10:25
  • I'm not sure, for what you would need FAST, but you easily can enable the "count" in the refinement panel for SP standard search also: Link. Edit: Standard count does not show moren than 500, see the blog post for details.
    – marco
    Apr 20, 2012 at 10:29
  • Even if you enable the count, you will not be able to get count from all the search results because SP Search provides only Shallow Refinement. Apr 20, 2012 at 11:38
6

enter image description hereOk, this is how I did it:

  1. Build a method that enables me to retrieve all items of a certain ContentType (use SPSiteDataQuery for Cross-Site in the same site collection, or simple SPQUery for a single list) - many examples available but look here for a start http://sharepoint-snippets.com/spsitedataquery-examples-for-sharepoint-2010/ (actually i've built my own methods as i've reused quite a lot)
  2. Look for the column the contains all the Managed Metadata you are looking for, but very important: SPField noteFieldOfTaxonomyField = childWeb.Site.RootWeb.Fields.GetField(string.Format("{0}_0", fieldName)); - this will return all the TAGS by using the HIDDEN field automatically created behind the scenes by SharePoint for every Managed Metadata.
  3. Use the same code found in the Web Part on the CodePlex (http://metadatawebpart.codeplex.com/) to build your tag, which actually splits the TERMS and calculates ranking.
  4. With results I actually build an alternative so that for MM fields allowing a single selection I generate a List rather then a cloud (see screens attached for actual examples).

Hope it helps let me know if I you need more details, C:\Marius

6
  • Thanks for your answer. However, SPSiteDataquery and SPQuery are not good choice when aggregating large data
    – SP.NET
    Apr 20, 2012 at 10:04
  • Oh yes they are - particularly the SPSiteDataQuery which could be used in conjunction with CrossListQueryCache which is actually the exact same way CQWP works. On the other hand best performances are obtained with CoreSearchResults which combine with using Keyword query and contentClass could help you retrieve all ContentTypes which could than be completed with the above and NO expensive Fast Search (plain Enterprise Search). Apr 20, 2012 at 11:24
  • SPSiteDataQuery has certain throttle limits.Like you said best performance is obtained by search, I think the same. However,My requirement is not to just search but to get counts of tags usage (sorted descending) in search results.Like @AmitKumawat said it can be done with deep refiners in Fast Search and SP Search don't offer this functionality.Can you please give me hint how can we calculate count of tags usage using keyword query in SP Search?
    – SP.NET
    Apr 20, 2012 at 12:16
  • It's all there and the Metadata web part from CodePlex has it built in / which is calculated as part of List/Cloud building. Actually this is how is calculating cloud - for your information we have over 2000 tags and almost 1000 articles already and is behaving excelent. Apr 20, 2012 at 12:23
  • The metdata webpart from codeplex only works at scope of a list.I need a Tag cloud that is scoped at web application level
    – SP.NET
    Apr 23, 2012 at 8:20
3

I know I'm sidestepping half of your question (others have provided good starting points), but check out this Codeplex project for the implementation of the Tag Cloud itself. Clean, lean interface & reusable: The tag cloud.

What I've done recently is build a TaxonomyDataSource class that provides terms in a standard Dictionary property (with some other stuff). Then in a separate webpart I'm rendering a nice Glossary, and a 3rd bit is the Tag Cloud.

I was pulling from only one list too.. Haven't had the need for multiple sources yet, but I would probably look at Search results with some local caching.

0

Well.. you could just create a custom webpart, get your Termset, and output the terms under

TaxonomySession session = new TaxonomySession(site);
session.TermStores["Managed Metadata Service"].Groups["GROUP"].TermSets["TERMSET"].Terms 

with a foreach.. Just put in your groupname and termsetname and leave the termstore / if you hvn't changed that to another and that should work fine... If you have your output you could make som thoughts ' bout how you wanna display that.. A nice jquery tag cloud i once found is: http://www.goat1000.com/tagcanvas.php... its highly configurable and has good compability options for IE and missing canvas support. As you can see , you only need to output something like:

<div id="tags">
  <ul>
    <li><a href="http://www.google.com" target="_blank">Google</a></li>
    <li><a href="/fish">Fish</a></li>
    <li><a href="/chips">Chips</a></li>
    <li><a href="/salt">Salt</a></li>
    <li><a href="/vinegar">Vinegar</a></li>
  </ul>
</div> 

which is fairly easy if you output the ul and then just enumerate through that terms, while adding the li before, and the /li after your terms...
In the end you can create some Webpart options, maybe to toggle special styles or to choose the right termset and maybe add caching aswell.. Good luck!

2
  • Do you have any idea how to get the count of how many times a particular term is used to tag the list items.
    – SP.NET
    Apr 18, 2012 at 5:28
  • Well, search is indeed a good point to start; Apr 19, 2012 at 7:18
0

I had almost the same requirements and come to creation of web part that interacts with Managed Metadata (to get terms from the specified term set) and Search (to get results). Then it builds a tag cloud for top results. Please check the link for more details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.