Changeset 15073


Ignore:
Timestamp:
2008-03-10T09:35:54+13:00 (14 years ago)
Author:
kjdon
Message:

added -reversesort option to import.pl. Used with -sortmeta option, to sort in reverse order

Location:
gsdl/trunk/perllib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/arcinfo.pm

    r12328 r15073  
    5252    my ($class) = @_;
    5353    my $self = {'info'=>{},
    54         'order'=>[]};
     54        'order'=>[],
     55        'reverse_sort'=>0};
    5556
    5657    return bless $self, $class;
     
    158159}
    159160
     161sub reverse_sort
     162{
     163    my $self = shift(@_);
     164    $self->{'reverse_sort'} = 1;
     165}
    160166
    161167# returns a list of the form [[OID, doc_file, index_status], ...]
     
    166172    my $order = $self->{'order'};
    167173
    168     my @sorted_order
    169     = sort {$a->[ORDER_SORT_INDEX] cmp $b->[ORDER_SORT_INDEX]} @$order;
     174    my @sorted_order;
     175    if ($self->{'reverse_sort'}) {
     176    @sorted_order = sort {$b->[ORDER_SORT_INDEX] cmp $a->[ORDER_SORT_INDEX]} @$order;
     177    } else {
     178    @sorted_order = sort {$a->[ORDER_SORT_INDEX] cmp $b->[ORDER_SORT_INDEX]} @$order;
     179    }
    170180
    171181    my @list = ();
     
    188198    my $order = $self->{'order'};
    189199
    190     my @sorted_order
    191     = sort {$a->[ORDER_SORT_INDEX] cmp $b->[ORDER_SORT_INDEX]} @$order;
     200    my @sorted_order;
     201    if ($self->{'reverse_sort'}) {
     202    @sorted_order = sort {$b->[ORDER_SORT_INDEX] cmp $a->[ORDER_SORT_INDEX]} @$order;
     203    } else {
     204    @sorted_order = sort {$a->[ORDER_SORT_INDEX] cmp $b->[ORDER_SORT_INDEX]} @$order;
     205    }
    192206
    193207    my @list = ();
  • gsdl/trunk/perllib/strings.properties

    r15019 r15073  
    269269import.removing_tmpdir:Removing contents of the collection "tmp" directory...
    270270
     271import.reversesort:Sort in reverse order. Used with the -sortmeta option.
     272
    271273import.sortmeta:Sort documents alphabetically by metadata for building. Search results for boolean queries will be displayed in this order. This will be disabled if groupsize > 1. May be a commma separated list to sort by more than one metadata value.
    272274
Note: See TracChangeset for help on using the changeset viewer.