Changeset 27069

Show
Ignore:
Timestamp:
12.03.2013 15:01:01 (7 years ago)
Author:
kjdon
Message:

adding in reverse sort option

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/bin/script/lucene_query.pl

    r16062 r27069  
    5959    my $filter_string = shift(@_); 
    6060    my $sort_field = shift(@_); 
     61    my $reverse_sort = shift(@_); 
    6162    my $dco = shift(@_); 
    6263    my $start_results = shift(@_); 
     
    7879        $cmd .= " -sort " . $sort_field; 
    7980    } 
     81    if ($reverse_sort) { 
     82    $cmd .= " -reverse_sort"; 
     83    } 
    8084    if (defined($dco)) { 
    8185        $cmd .= " -dco " . $dco; 
     
    9094    $cmd .= " > \"" . $out_file . "\""; 
    9195    } 
    92     # print STDERR $cmd . "\n"; 
     96    print STDERR $cmd . "\n"; 
    9397 
    9498    if (!open (PIPEOUT, $cmd)) { 
     
    107111    my $argc = scalar(@argv); 
    108112    if ($argc == 0) { 
    109     print STDERR "Usage: $PROGNAME full-index-dir [query] [-fuzziness value] [-filter filter_string] [-sort sort_field] [-dco AND|OR] [-startresults number -endresults number] [-out out_file]\n"; 
     113    print STDERR "Usage: $PROGNAME full-index-dir [query] [-fuzziness value] [-filter filter_string] [-sort sort_field] [-reverse_sort]  [-dco AND|OR] [-startresults number -endresults number] [-out out_file]\n"; 
    110114    exit 1; 
    111115    } 
     
    116120    my $filter_string = undef; 
    117121    my $sort_field = undef; 
     122    my $reverse_sort = 0; 
    118123    my $dco = undef; 
    119124    my $start_results = undef; 
     
    133138            $i++; 
    134139            $sort_field = $argv[$i]; 
     140    } 
     141    elsif ($argv[$i] eq "-reverse_sort") { 
     142        $reverse_sort = 1; 
    135143    } 
    136144        elsif ($argv[$i] eq "-dco") { 
     
    155163    } 
    156164 
    157     open_java_lucene($full_indexdir, $fuzziness, $filter_string, $sort_field, $dco, $start_results, $end_results, $out_file); 
     165    open_java_lucene($full_indexdir, $fuzziness, $filter_string, $sort_field, $reverse_sort, $dco, $start_results, $end_results, $out_file); 
    158166 
    159167    if (defined $query) {