Item12828: TagCloud Plugin with normalization = log always shows "nothing found"
Priority: Normal
Current State: Closed
Released In: n/a
Target Release:
I installed
TagCloud Plugin in FW 1.1.8 but it did not yield any result even in the default configuration in the
TagCloudPlugin topic. It always showed "nothing found".
I analyzed it and there seems to be a problem in the code with calculating the logarithm resulting in an empty tag list.
I believe that the foreach (roughly around line 520 in Core.pm)
foreach my $term (@terms) {
# truncation
if ($termCount{$term} < $theMin) {
delete $termCount{$term};
next;
}
# normalization
$termCount{$term} = log($origTermCount{$term}) if $theNormalize == NORMALIZ$
$ceiling = $termCount{$term}
if $termCount{$term} > $ceiling;
$floor = $termCount{$term}
if $termCount{$term} < $floor || $floor < 0;
}
should be
foreach my $term (@terms) {
# truncation
#First replacement of $termCount with $origTermCount
if ($origTermCount{$term} < $theMin) {
$debugString .= "Removing " . $term . " with count " . $origTermCount{$t$
delete $termCount{$term};
next;
}
# normalization
# Second replacement
$termCount{$term} = log($origTermCount{$term}) if $theNormalize == NORMALIZ$
$ceiling = $termCount{$term}
if $termCount{$term} > $ceiling;
$floor = $termCount{$term}
if $termCount{$term} < $floor || $floor < 0;
}
Otherwise the value in $termCount{$term} gets overwritten with the logarithm of the number of occurences of that term and since this is a completely different value it fails the comparison $origTermCount{$term} < $theMin on the next iteration (which results in getting the term removed from the tag list). My tagCloud was always empty, but after replacing those variables it worked.
However, I did not check this properly, so maybe you can verify or improve this solution.
Btw, the plugin also worked when setting "normalized" = "linear" in the options.
Thanks!
--
MichaelHelwig - 28 Mar 2014
Thanks for the patch. Fixed in 3.01.
--
MichaelDaum - 15 May 2014