Changeset 16264
- Timestamp:
- 2008-07-01T17:37:42+12:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/bin/script/lucene_passes.pl
r16263 r16264 40 40 sub open_java_lucene 41 41 { 42 my ($doc_tag_level,$full_builddir,$indexdir,$ create,$verbosity) = @_;42 my ($doc_tag_level,$full_builddir,$indexdir,$java_lucene_options) = @_; 43 43 44 44 my $bin_java = &util::filename_cat($ENV{'GSDLHOME'},"bin","java"); … … 46 46 47 47 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"; 50 49 51 50 open (PIPEOUT, "| $java_cmd") or die "lucene_passes.pl - couldn't run $java_cmd\n"; … … 142 141 # * the command line of the java wrapper. 143 142 # * 144 # * Do not set -create and -remove at the same time, although -create is145 # * required for -remove, -remove will set it it's self, if you set -create146 # * after -remove the create will be ignored.147 # *148 # * @version 2.0 Added support for removing documents from the index by John Rowe149 # *150 143 # * @author John Rowe, DL Consulting 151 144 # */ … … 155 148 my $argc = scalar(@argv); 156 149 157 my $create = ""; 158 my $verbosity = 1; 159 150 my $java_lucene_options = ""; 160 151 my @filtered_argv = (); 161 152 … … 166 157 my $option = $1; 167 158 168 # - create causes build to be incremental169 if ($option eq ("create")) {170 print STDERR "\n \n-createset\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 "; 172 163 } 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> 192 165 elsif ($option eq "verbosity") { 193 166 $i++; 194 if ($i<$argc) { 195 $verbosity = $argv[$i]; 167 if ($i<$argc) 168 { 169 $java_lucene_options .= "-verbosity " . $argv[$i]; 196 170 } 197 171 } … … 209 183 210 184 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"; 212 186 exit 1; 213 187 } … … 221 195 # We only need the Lucene handle opened if we are indexing the documents, not if we are just storing the text 222 196 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); 224 198 } 225 199
Note:
See TracChangeset
for help on using the changeset viewer.