Changeset 20865


Ignore:
Timestamp:
2009-10-30T10:55:28+13:00 (14 years ago)
Author:
kjdon
Message:

changed per_letter_fixed_size to approximate_size, allow the former for backwards compatibility, uppercase metadata before sorting, approximate_size now generates an hlist by default

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/classify/List.pm

    r20825 r20865  
    4747    [ { 'name' => "per_letter",
    4848    'desc' => "{List.level_partition.per_letter}" },
     49      { 'name' => "approximate_size",
     50    'desc' => "{List.level_partition.approximate_size}"},
    4951      { 'name' => "constant_size",
    5052    'desc' => "{List.level_partition.constant_size}" },     
    51       { 'name' => "per_letter_fixed_size",
    52     'desc' => "{List.level_partition.per_letter_fixed_size}"},
    5353      { 'name' => "none",
    5454    'desc' => "{List.level_partition.none}" } ];
     
    5858                  'constant_size' => 1,
    5959                  'per_letter_fixed_size' => 1,
     60                  'approximate_size' => 1,
    6061                  'none' => 1};
    6162
     
    176177    foreach my $metadata_group (@metadata_groups) {
    177178        my $partition_type_within_levelelem = shift(@partition_type_within_levellist);
     179        if (defined($partition_type_within_levelelem) && $partition_type_within_levelelem eq "per_letter_fixed_size") {
     180        print STDERR "per letter fixed size, changing to approximate size\n";
     181        $partition_type_within_levelelem = "approximate_size";
     182        }
    178183        if (defined($partition_type_within_levelelem) && defined $valid_partition_types->{$partition_type_within_levelelem}) {
    179184        $self->{$metadata_group . ".partition_type_within_level"} = $partition_type_within_levelelem;
     
    376381            }
    377382
     383            # uppercase the metadata - makes the AZList nicer
     384            $metadata_value = uc($metadata_value);
    378385            # Convert the metadata value from a UTF-8 string to a Unicode string
    379386            # This means that length() and substr() work properly
     
    477484    $classifier_node->{'childtype'} = "HList";
    478485    }
    479     elsif ($partition_type_within_level =~ /^per_letter_fixed_size$/i) {
     486    elsif ($partition_type_within_level =~ /^approximate_size$/i) {
    480487    # Generate hlist based on the first letter of the metadata value (like per_letter) but with restriction on the partition size
    481488    # If a letter has fewer items than specified by the "partition_size_within_level", then group them together if possible
     
    622629        }
    623630    }   
    624     }
     631   
     632    # The partitions are stored in an HList
     633    $classifier_node->{'childtype'} = "HList";
     634
     635    } # end approximate_size
    625636    else {
    626637    # Generate hlists of a certain size
Note: See TracChangeset for help on using the changeset viewer.