Changeset 27697


Ignore:
Timestamp:
2013-06-24T17:23:04+12:00 (11 years ago)
Author:
ak19
Message:

Dr Bainbridge fixed it so that the gdb files generated on Windows for diffcol match those on Linux. This actually involved changing the order in which docids appear in archiveinf-doc. This last needed the newly invented flag -sort to the ArchivesInfPlugin in combination with -sortmeta OID to import.pl

Location:
main/trunk/greenstone2/perllib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/arcinfo.pm

    r21857 r27697  
    6767        'reverse-info'=>{},
    6868        'order'=>[],
    69         'reverse_sort'=>0};
     69        'reverse_sort'=>0,
     70        'sort'=>0};
    7071
    7172    return bless $self, $class;
     
    323324
    324325    $self->{'info'}->{$OID} = [$doc_file,$index_status,$sortmeta];
    325     push (@{$self->{'order'}}, [$OID, $sortmeta]);
     326    push (@{$self->{'order'}}, [$OID, $sortmeta]); # ORDER_OID_INDEX and ORDER_SORT_INDEX
    326327
    327328
     
    393394    $self->{'reverse_sort'} = 1;
    394395}
     396sub sort
     397{
     398    my $self = shift(@_);
     399    $self->{'sort'} = 1;
     400}
     401
    395402
    396403# returns a list of the form [[OID, doc_file, index_status], ...]
     
    404411    if ($self->{'reverse_sort'}) {
    405412    @sorted_order = sort {$b->[ORDER_SORT_INDEX] cmp $a->[ORDER_SORT_INDEX]} @$order;
    406     } else {
     413    } elsif ($self->{'sort'}) {
    407414    @sorted_order = sort {$a->[ORDER_SORT_INDEX] cmp $b->[ORDER_SORT_INDEX]} @$order;
     415    } else { # not sorting, don't bother
     416    @sorted_order = @$order;
    408417    }
    409418
     
    430439    if ($self->{'reverse_sort'}) {
    431440    @sorted_order = sort {$b->[ORDER_SORT_INDEX] cmp $a->[ORDER_SORT_INDEX]} @$order;
    432     } else {
     441    } elsif ($self->{'sort'}) {
    433442    @sorted_order = sort {$a->[ORDER_SORT_INDEX] cmp $b->[ORDER_SORT_INDEX]} @$order;
     443    } else { # not sorting, don't bother
     444    @sorted_order = @$order;
    434445    }
    435446
  • main/trunk/greenstone2/perllib/plugins/ArchivesInfPlugin.pm

    r27306 r27697  
    5252    'reqd' => "no",
    5353    'modegli' => "2" },
     54    { 'name' => "sort",
     55    'desc' => "{ArchivesInfPlugin.sort}",
     56    'type' => "flag",
     57    'reqd' => "no",
     58    'modegli' => "2" }
    5459
    5560         ];
     
    244249    if ($self->{'reversesort'}) {
    245250        $archive_info->reverse_sort();
     251    } elsif ($self->{'sort'}) {
     252        $archive_info->sort();
    246253    }
    247254   
  • main/trunk/greenstone2/perllib/plugouts/BasePlugout.pm

    r27646 r27697  
    477477    my $output_info = $self->{'output_info'};
    478478    my $metaname = $self->{'sortmeta'};
     479   
    479480    if (!defined $metaname || $metaname !~ /\S/) {
    480     $output_info->add_info($doc_obj->get_OID(),$self->{'short_doc_file'}, undef, "");
     481    my $OID = $doc_obj->get_OID();
     482    $output_info->add_info($OID,$self->{'short_doc_file'}, undef, "");
    481483    return;
    482484    }
     485   
     486    if ($metaname eq "OID") { # sort by OID
     487    my $OID = $doc_obj->get_OID();
     488    $output_info->add_info($OID,$self->{'short_doc_file'}, undef, $OID);
     489    return;
     490    }
    483491   
    484492    my $metadata = "";
  • main/trunk/greenstone2/perllib/strings.properties

    r27646 r27697  
    314314import.site:Site to find collect directory in (for Greenstone 3 installation).
    315315
    316 import.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.
     316import.sortmeta:Sort documents alphabetically by metadata for building (specifying -sortmeta as 'OID' is a special case, and instructs Greenstone to use the document identifier for ordering). Search results for boolean queries will be displayed in the order determined by sortmeta. This will be disabled if groupsize > 1. May be a commma separated list to sort by more than one metadata value.
    317317
    318318import.statsfile:Filename or handle to print import statistics to.
     
    742742
    743743ArchivesInfPlugin.desc:Plugin which processes the archive info database (archiveinf-doc) which is generated by the import process. It passes each archive file listed in the database to the plugin pipeline to be processed by GreenstoneXMLPlugin.
    744 ArchivesInfPlugin.reversesort:Sort in reverse order. Useful if the -sortmeta option was used with import.pl.
     744ArchivesInfPlugin.reversesort:Sort in reverse alphabetical order. Useful if the -sortmeta option was used with import.pl.
     745ArchivesInfPlugin.sort:Sort in ascending alphabetical order. Useful if the -sortmeta option was used with import.pl.
    745746
    746747AutoExtractMetadata.desc: Base plugin that brings together all the extractor functionality from the extractor plugins.
Note: See TracChangeset for help on using the changeset viewer.