Changeset 16264


Ignore:
Timestamp:
2008-07-01T17:37:42+12:00 (16 years ago)
Author:
mdewsnip
Message:

Changed "-create" to "-removeold", and removed the non-functional "-remove <OID>" option.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/bin/script/lucene_passes.pl

    r16263 r16264  
    4040sub open_java_lucene
    4141{
    42   my ($doc_tag_level,$full_builddir,$indexdir,$create,$verbosity) = @_;
     42  my ($doc_tag_level,$full_builddir,$indexdir,$java_lucene_options) = @_;
    4343
    4444  my $bin_java = &util::filename_cat($ENV{'GSDLHOME'},"bin","java");
     
    4646
    4747  my $java_lucene = "java -classpath \"$classpath\" org.greenstone.LuceneWrapper.GS2LuceneIndexer";
    48   my $cmd_options = "$create -verbosity $verbosity";
    49   my $java_cmd = "$java_lucene $cmd_options $doc_tag_level \"$full_builddir\" $indexdir";
     48  my $java_cmd = "$java_lucene $java_lucene_options $doc_tag_level \"$full_builddir\" $indexdir";
    5049
    5150  open (PIPEOUT, "| $java_cmd") or die "lucene_passes.pl - couldn't run $java_cmd\n";
     
    142141#  *  the command line of the java wrapper.
    143142#  *
    144 #  *  Do not set -create and -remove at the same time, although -create is
    145 #  *  required for -remove, -remove will set it it's self, if you set -create
    146 #  *  after -remove the create will be ignored.
    147 #  *
    148 #  *  @version 2.0 Added support for removing documents from the index by John Rowe
    149 #  *
    150143#  *  @author John Rowe, DL Consulting
    151144#  */
     
    155148  my $argc = scalar(@argv);
    156149
    157   my $create = "";
    158   my $verbosity = 1;
    159 
     150  my $java_lucene_options = "";
    160151  my @filtered_argv = ();
    161152
     
    166157      my $option = $1;
    167158
    168       # -create causes build to be incremental
    169       if ($option eq ("create")) {
    170         print STDERR "\n\n-create set\n";
    171         $create = "-create";
     159      # -removeold causes the existing index to be overwritten
     160      if ($option eq "removeold") {
     161        print STDERR "\n-removeold set\n";
     162        $java_lucene_options .= "-removeold ";
    172163      }
    173       # In a blinding flash of unintuitiveness -remove causes
    174       # -create to be set (we don't want to remove the old indexes)
    175       elsif($option eq "remove")
    176       {
    177         # Look at the next arg for the oid and if that doesn't exist then
    178         $i++;
    179         if(!defined $argv[$i])
    180         {
    181           print STDERR "Remove was specified but the OID was not specified";
    182           die "\n\nCannot continue";
    183         }
    184         my $oid = $argv[$i];
    185         print STDERR "\n\nWe're removing the document with id: '$oid'\n";
    186 
    187         # Now, to make sure this gets through to the Java executable
    188         $create = "-create -remove '$oid'";
    189       }
    190 
    191       # -verbosity num
     164      # -verbosity <num>
    192165      elsif ($option eq "verbosity") {
    193166        $i++;
    194         if ($i<$argc) {
    195           $verbosity = $argv[$i];
     167        if ($i<$argc)
     168    {
     169      $java_lucene_options .= "-verbosity " . $argv[$i];
    196170        }
    197171      }
     
    209183
    210184  if ($filtered_argc < 4) {
    211     print STDERR "Usage: lucene_passes.pl [-create|-verbosity num] \"text\"|\"index\" doc-tag-level build-dir index-name\n";
     185    print STDERR "Usage: lucene_passes.pl [-removeold|-verbosity num] \"text\"|\"index\" doc-tag-level build-dir index-name\n";
    212186    exit 1;
    213187  }
     
    221195  # We only need the Lucene handle opened if we are indexing the documents, not if we are just storing the text
    222196  if ($mode eq "index") {
    223     open_java_lucene($doc_tag_level,$full_builddir,$indexdir,$create,$verbosity);
     197    open_java_lucene($doc_tag_level, $full_builddir, $indexdir, $java_lucene_options);
    224198  }
    225199
Note: See TracChangeset for help on using the changeset viewer.