Apparent bug with number of tags and size of tag cloud widget

Topics: Controls
Jun 21, 2012 at 2:10 PM
Edited Jun 21, 2012 at 4:54 PM

It appears that in BE 2.6 that once i hit about 100 tags in the cloud widget the size of the widget shrinks so that it only shows tags with >/= 2 posts. Yet the count in the widget is set to 1 and unlimited size. Is this some feature of BE? Also it happens when i hit 34 posts. At 34 the cloud widget shrinks to show tags with >/= 2 posts

Jun 21, 2012 at 4:33 PM
Edited Jun 21, 2012 at 4:54 PM

It does not seem dependent of total number of tags but rather it occurs when one particular word/tag gets a certain number of posts associated with it. In this at 34 posts for one tag - that causes the cloud widget to then not show those tags with only 1 post associated them . Need a fix, please. I can confirm it is repeatable - once i hit 34 posts for a specific tag - the tag cloud shrinks and only shows tags with > 1 post

Jun 21, 2012 at 7:08 PM

In the widgets folder find the file widget.ascx.cs in the Tag Cloud folder.

Try changing the the last weight value check in the following function to a value less than 3.

/// <summary>
        /// Sorts the list of tags based on how much they are used.
        /// </summary>
        private void SortList()
        {
            var dic = CreateRawList();
            var max = dic.Values.Max();

            var currentTagCount = 0;

            foreach (var key in
                dic.Keys.Where(key => dic[key] >= this.MinimumPosts).Where(
                    key => this.TagCloudSize <= 0 || currentTagCount < this.TagCloudSize))
            {
                currentTagCount++;

                var weight = ((double)dic[key] / max) * 100;
                if (weight >= 99)
                {
                    WeightedList.Add(key, "biggest");
                }
                else if (weight >= 70)
                {
                    WeightedList.Add(key, "big");
                }
                else if (weight >= 40)
                {
                    WeightedList.Add(key, "medium");
                }
                else if (weight >= 20)
                {
                    WeightedList.Add(key, "small");
                }
                //else if (weight >= 3)//change me to this
		else if (weight >= 1)
                {
                    WeightedList.Add(key, "smallest");
                }
            }
        }

It's probably worth mentioning that the SortList() function in the tag control in the App_Code folder requires altering.

The part that needs altering is as follows, it should be the same as the code in the widget (above)

var currentTagCount = 0;

            int count = currentTagCount;
            foreach (var key in
                dic.Keys.Where(key => dic[key] >= this.MinimumPosts).Where(key => this.TagCloudSize <= 0 || count <= this.TagCloudSize))
            {
                currentTagCount++;