Item12828: TagCloud Plugin with normalization = log always shows "nothing found"

pencil
Priority: Normal
Current State: Closed
Released In: n/a
Target Release:
Applies To: Extension
Component: TagCloudPlugin
Branches: trunk
Reported By: MichaelHelwig
Waiting For:
Last Change By: MichaelDaum
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
 

ItemTemplate edit

Summary TagCloud Plugin with normalization = log always shows "nothing found"
ReportedBy MichaelHelwig
Codebase 1.1.8
SVN Range
AppliesTo Extension
Component TagCloudPlugin
Priority Normal
CurrentState Closed
WaitingFor
Checkins TagCloudPlugin:aa7d945b9cb9
ReleasedIn n/a
CheckinsOnBranches trunk
trunkCheckins TagCloudPlugin:aa7d945b9cb9
Release01x01Checkins
Topic revision: r3 - 15 May 2014, MichaelDaum
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy