source: main/trunk/greenstone2/perllib/mgbuilder.pm@ 27986

Last change on this file since 27986 was 27986, checked in by ak19, 11 years ago

Fixing syntax error: forgot semi-colon

  • Property svn:keywords set to Author Date Id Revision
File size: 19.9 KB
Line 
1###########################################################################
2#
3# mgbuilder.pm -- MGBuilder object
4# A component of the Greenstone digital library software
5# from the New Zealand Digital Library Project at the
6# University of Waikato, New Zealand.
7#
8# Copyright (C) 1999 New Zealand Digital Library Project
9#
10# This program is free software; you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation; either version 2 of the License, or
13# (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with this program; if not, write to the Free Software
22# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23#
24###########################################################################
25
26package mgbuilder;
27
28use basebuilder;
29use plugin;
30use strict; no strict 'refs';
31use util;
32use FileUtils;
33
34
35BEGIN {
36 @mgbuilder::ISA = ('basebuilder');
37}
38
39
40my %wanted_index_files = ('td'=>1,
41 't'=>1,
42 'idb'=>1,
43 'ib1'=>1,
44 'ib2'=>1,
45 'ib3'=>1,
46 'i'=>1,
47 'ip'=>1,
48 'tiw'=>1,
49 'wa'=>1);
50
51my $maxdocsize = $basebuilder::maxdocsize;
52
53
54sub new {
55 my $class = shift(@_);
56
57 my $self = new basebuilder (@_);
58 $self = bless $self, $class;
59
60 $self->{'buildtype'} = "mg";
61 return $self;
62}
63
64sub default_buildproc {
65 my $self = shift (@_);
66
67 return "mgbuildproc";
68}
69
70sub generate_index_list {
71 my $self = shift (@_);
72
73 if (!defined($self->{'collect_cfg'}->{'indexes'})) {
74 $self->{'collect_cfg'}->{'indexes'} = [];
75 }
76 if (scalar(@{$self->{'collect_cfg'}->{'indexes'}}) == 0) {
77 # no indexes have been specified so we'll build a "dummy:text" index
78 push (@{$self->{'collect_cfg'}->{'indexes'}}, "dummy:text");
79 }
80 # remove any ex. but only if there are no other metadata prefixes
81 my @orig_indexes = @{$self->{'collect_cfg'}->{'indexes'}};
82 $self->{'collect_cfg'}->{'indexes'} = [];
83 foreach my $index (@orig_indexes) {
84 #$index =~ s/ex\.([^.,:]+)(,|:|$)/$1$2/g; # doesn't preserve flex.Image, which is turned into fl.Image
85 $index =~ s/(,|:)/$1 /g;
86 $index =~ s/(^| )ex\.([^.,:]+)(,|:|$)/$1$2$3/g;
87 $index =~ s/(,|:) /$1/g;
88
89 push (@{$self->{'collect_cfg'}->{'indexes'}}, $index);
90 }
91}
92
93sub generate_index_options {
94 my $self = shift (@_);
95 $self->SUPER::generate_index_options();
96
97 $self->{'casefold'} = 0;
98 $self->{'stem'} = 0;
99 $self->{'accentfold'} = 0; #not yet implemented for mg
100
101 if (!defined($self->{'collect_cfg'}->{'indexoptions'})) {
102 # just use default options
103 $self->{'casefold'} = 1;
104 $self->{'stem'} = 1;
105
106 } else {
107 foreach my $option (@{$self->{'collect_cfg'}->{'indexoptions'}}) {
108 if ($option =~ /stem/) {
109 $self->{'stem'} = 1;
110 } elsif ($option =~ /casefold/) {
111 $self->{'casefold'} = 1;
112 }
113 }
114 }
115
116 # now we record this for the build cfg
117 $self->{'stemindexes'} = 0;
118 if ($self->{'casefold'}) {
119 $self->{'stemindexes'} += 1;
120 }
121 if ($self->{'stem'}) {
122 $self->{'stemindexes'} += 2;
123 }
124
125
126}
127
128sub compress_text {
129 my $self = shift (@_);
130 my ($textindex) = @_;
131 my $exedir = "$ENV{'GSDLHOME'}/bin/$ENV{'GSDLOS'}";
132 my $exe = &util::get_os_exe ();
133 my $mg_passes_exe = &FileUtils::filenameConcatenate($exedir, "mg_passes$exe");
134 my $mg_compression_dict_exe = &FileUtils::filenameConcatenate($exedir, "mg_compression_dict$exe");
135 my $outhandle = $self->{'outhandle'};
136
137 my $maxnumeric = $self->{'maxnumeric'};
138
139 &FileUtils::makeAllDirectories (&FileUtils::filenameConcatenate($self->{'build_dir'}, "text"));
140
141 my $collect_tail = &util::get_dirsep_tail($self->{'collection'});
142 my $basefilename = &FileUtils::filenameConcatenate("text",$collect_tail);
143 my $fulltextprefix = &FileUtils::filenameConcatenate($self->{'build_dir'}, $basefilename);
144
145 my $osextra = "";
146 if ($ENV{'GSDLOS'} =~ /^windows$/i) {
147 $fulltextprefix =~ s@/@\\@g;
148 } else {
149 $osextra = " -d /";
150 }
151
152 print $outhandle "\n*** creating the compressed text\n" if ($self->{'verbosity'} >= 1);
153 print STDERR "<Stage name='CompressText'>\n" if $self->{'gli'};
154
155 # collect the statistics for the text
156 # -b $maxdocsize sets the maximum document size to be 12 meg
157 print $outhandle "\n collecting text statistics\n" if ($self->{'verbosity'} >= 1);
158 print STDERR "<Phase name='CollectTextStats'/>\n" if $self->{'gli'};
159
160 my ($handle);
161 if ($self->{'debug'}) {
162 $handle = *STDOUT;
163 }
164 else {
165 if (!-e "$mg_passes_exe" ||
166 !open($handle, "| mg_passes$exe -f \"$fulltextprefix\" -b $maxdocsize -T1 -M $maxnumeric $osextra")) {
167 print STDERR "<FatalError name='NoRunMGPasses'>\n</Stage>\n" if $self->{'gli'};
168 die "mgbuilder::compress_text - couldn't run $mg_passes_exe\n";
169 }
170 }
171
172 $self->{'buildproc'}->set_output_handle ($handle);
173 $self->{'buildproc'}->set_mode ('text');
174 $self->{'buildproc'}->set_index ($textindex);
175 $self->{'buildproc'}->set_indexing_text (0);
176
177
178 if ($self->{'no_text'}) {
179 $self->{'buildproc'}->set_store_text(0);
180 } else {
181 $self->{'buildproc'}->set_store_text(1);
182 }
183 $self->{'buildproc'}->reset();
184
185 &plugin::begin($self->{'pluginfo'}, $self->{'source_dir'},
186 $self->{'buildproc'}, $self->{'maxdocs'});
187 &plugin::read ($self->{'pluginfo'}, $self->{'source_dir'},
188 "", {}, {}, $self->{'buildproc'}, $self->{'maxdocs'}, 0, $self->{'gli'});
189 &plugin::end($self->{'pluginfo'});
190
191
192 close ($handle) unless $self->{'debug'};
193
194 $self->print_stats();
195
196 # create the compression dictionary
197 # the compression dictionary is built by assuming the stats are from a seed
198 # dictionary (-S), if a novel word is encountered it is spelled out (-H),
199 # and the resulting dictionary must be less than 5 meg with the most frequent
200 # words being put into the dictionary first (-2 -k 5120)
201 if (!$self->{'debug'}) {
202 print $outhandle "\n creating the compression dictionary\n" if ($self->{'verbosity'} >= 1);
203 print STDERR "<Phase name='CreatingCompress'/>\n" if $self->{'gli'};
204 if (!-e "$mg_compression_dict_exe") {
205 die "mgbuilder::compress_text - couldn't run $mg_compression_dict_exe\n";
206 }
207 system ("mg_compression_dict$exe -f \"$fulltextprefix\" -S -H -2 -k 5120 $osextra");
208
209 # -b $maxdocsize sets the maximum document size to be 12 meg
210 if (!-e "$mg_passes_exe" ||
211 !open ($handle, "| mg_passes$exe -f \"$fulltextprefix\" -b $maxdocsize -T2 -M $maxnumeric $osextra")) {
212 print STDERR "<FatalError name='NoRunMGPasses'/>\n</Stage>\n" if $self->{'gli'};
213 die "mgbuilder::compress_text - couldn't run $mg_passes_exe\n";
214 }
215 }
216 else {
217 print STDERR "<Phase name='SkipCreatingComp'/>\n" if $self->{'gli'};
218 }
219
220 $self->{'buildproc'}->set_output_handle ($handle);
221 $self->{'buildproc'}->reset();
222
223 # compress the text
224 print $outhandle "\n compressing the text\n" if ($self->{'verbosity'} >= 1);
225 print STDERR "<Phase name='CompressingText'/>\n" if $self->{'gli'};
226
227 &plugin::read ($self->{'pluginfo'}, $self->{'source_dir'},
228 "", {}, {}, $self->{'buildproc'}, $self->{'maxdocs'}, 0, $self->{'gli'});
229
230 close ($handle) unless $self->{'debug'};
231
232 $self->print_stats();
233 print STDERR "</Stage>\n" if $self->{'gli'};
234}
235
236
237# creates directory names for each of the index descriptions
238sub create_index_mapping {
239 my $self = shift (@_);
240 my ($indexes) = @_;
241
242 my %mapping = ();
243 $mapping{'indexmaporder'} = [];
244 $mapping{'subcollectionmaporder'} = [];
245 $mapping{'languagemaporder'} = [];
246
247 # dirnames is used to check for collisions. Start this off
248 # with the manditory directory names
249 my %dirnames = ('text'=>'text',
250 'extra'=>'extra');
251 my %pnames = ('index' => {}, 'subcollection' => {}, 'languages' => {});
252 foreach my $index (@$indexes) {
253 my ($level, $gran, $subcollection, $languages) = split (":", $index);
254
255 # the directory name starts with the first character of the index level
256 my ($pindex) = $level =~ /^(.)/;
257
258 # next comes a processed version of the index
259 $pindex .= $self->process_field ($gran);
260 $pindex = lc ($pindex);
261
262 # next comes a processed version of the subcollection if there is one.
263 my $psub = $self->process_field ($subcollection);
264 $psub = lc ($psub);
265
266 # next comes a processed version of the language if there is one.
267 my $plang = $self->process_field ($languages);
268 $plang = lc ($plang);
269
270 my $dirname = $pindex . $psub . $plang;
271
272 # check to be sure all index names are unique
273 while (defined ($dirnames{$dirname})) {
274 $dirname = $self->make_unique (\%pnames, $index, \$pindex, \$psub, \$plang);
275 }
276 $mapping{$index} = $dirname;
277
278 # store the mapping orders as well as the maps
279 # also put index, subcollection and language fields into the mapping thing -
280 # (the full index name (eg document:text:subcol:lang) is not used on
281 # the query page) -these are used for collectionmeta later on
282 if (!defined $mapping{'indexmap'}{"$level:$gran"}) {
283 $mapping{'indexmap'}{"$level:$gran"} = $pindex;
284 push (@{$mapping{'indexmaporder'}}, "$level:$gran");
285 if (!defined $mapping{"$level:$gran"}) {
286 $mapping{"$level:$gran"} = $pindex;
287 }
288 }
289 if ($psub =~ /\w/ && !defined ($mapping{'subcollectionmap'}{$subcollection})) {
290 $mapping{'subcollectionmap'}{$subcollection} = $psub;
291 push (@{$mapping{'subcollectionmaporder'}}, $subcollection);
292 $mapping{$subcollection} = $psub;
293 }
294 if ($plang =~ /\w/ && !defined ($mapping{'languagemap'}{$languages})) {
295 $mapping{'languagemap'}{$languages} = $plang;
296 push (@{$mapping{'languagemaporder'}}, $languages);
297 $mapping{$languages} = $plang;
298 }
299 $dirnames{$dirname} = $index;
300 $pnames{'index'}->{$pindex} = "$level:$gran";
301 $pnames{'subcollection'}->{$psub} = $subcollection;
302 $pnames{'languages'}->{$plang} = $languages;
303 }
304
305 return \%mapping;
306}
307
308
309sub make_unique {
310 my $self = shift (@_);
311 my ($namehash, $index, $indexref, $subref, $langref) = @_;
312 my ($level, $gran, $subcollection, $languages) = split (":", $index);
313
314 if ($namehash->{'index'}->{$$indexref} ne "$level:$gran") {
315 $self->get_next_version ($indexref);
316 } elsif ($namehash->{'subcollection'}->{$$subref} ne $subcollection) {
317 $self->get_next_version ($subref);
318 } elsif ($namehash->{'languages'}->{$$langref} ne $languages) {
319 $self->get_next_version ($langref);
320 }
321 return "$$indexref$$subref$$langref";
322}
323
324sub build_index {
325 my $self = shift (@_);
326 my ($index) = @_;
327 my $outhandle = $self->{'outhandle'};
328
329 # get the full index directory path and make sure it exists
330 my $indexdir = $self->{'index_mapping'}->{$index};
331 &FileUtils::makeAllDirectories (&FileUtils::filenameConcatenate($self->{'build_dir'}, $indexdir));
332
333 my $collect_tail = &util::get_dirsep_tail($self->{'collection'});
334 my $fullindexprefix = &FileUtils::filenameConcatenate($self->{'build_dir'}, $indexdir,
335 $collect_tail);
336 my $fulltextprefix = &FileUtils::filenameConcatenate($self->{'build_dir'}, "text",
337 $collect_tail);
338
339 # get any os specific stuff
340 my $exedir = "$ENV{'GSDLHOME'}/bin/$ENV{'GSDLOS'}";
341 my $exe = &util::get_os_exe ();
342 my $mg_passes_exe = &FileUtils::filenameConcatenate($exedir, "mg_passes$exe");
343 my $mg_perf_hash_build_exe =
344 &FileUtils::filenameConcatenate($exedir, "mg_perf_hash_build$exe");
345 my $mg_weights_build_exe =
346 &FileUtils::filenameConcatenate($exedir, "mg_weights_build$exe");
347 my $mg_invf_dict_exe =
348 &FileUtils::filenameConcatenate($exedir, "mg_invf_dict$exe");
349 my $mg_stem_idx_exe =
350 &FileUtils::filenameConcatenate($exedir, "mg_stem_idx$exe");
351
352 my $maxnumeric = $self->{'maxnumeric'};
353
354 my $osextra = "";
355 if ($ENV{'GSDLOS'} =~ /^windows$/i) {
356 $fullindexprefix =~ s@/@\\@g;
357 } else {
358 $osextra = " -d /";
359 if ($outhandle ne "STDERR") {
360 # so mg_passes doesn't print to stderr if we redirect output
361 $osextra .= " 2>/dev/null";
362 }
363 }
364
365 # get the index level from the index description
366 # the index will be level 2 unless we are building a
367 # paragraph level index
368 my $index_level = 2;
369 $index_level = 3 if $index =~ /^paragraph/i;
370
371 # get the index expression if this index belongs
372 # to a subcollection
373 my $indexexparr = [];
374 my $langarr = [];
375 # there may be subcollection info, and language info.
376 my ($level, $fields, $subcollection, $language) = split (":", $index);
377 my @subcollections = ();
378 @subcollections = split /,/, $subcollection if (defined $subcollection);
379
380 foreach my $subcollection (@subcollections) {
381 if (defined ($self->{'collect_cfg'}->{'subcollection'}->{$subcollection})) {
382 push (@$indexexparr, $self->{'collect_cfg'}->{'subcollection'}->{$subcollection});
383 }
384 }
385
386 # add expressions for languages if this index belongs to
387 # a language subcollection - only put languages expressions for the
388 # ones we want in the index
389
390 my @languages = ();
391 my $languagemetadata = "Language";
392 if (defined ($self->{'collect_cfg'}->{'languagemetadata'})) {
393 $languagemetadata = $self->{'collect_cfg'}->{'languagemetadata'};
394 }
395 @languages = split /,/, $language if (defined $language);
396 foreach my $language (@languages) {
397 my $not=0;
398 if ($language =~ s/^\!//) {
399 $not = 1;
400 }
401 if($not) {
402 push (@$langarr, "!$language");
403 } else {
404 push (@$langarr, "$language");
405 }
406 }
407
408 # Build index dictionary. Uses verbatim stem method
409 print $outhandle "\n creating index dictionary\n" if ($self->{'verbosity'} >= 1);
410 print STDERR "<Phase name='CreatingIndexDic'/>\n" if $self->{'gli'};
411 my ($handle);
412 if ($self->{'debug'}) {
413 $handle = *STDOUT;
414 }
415 else {
416 if (!-e "$mg_passes_exe" ||
417 !open($handle, "| mg_passes$exe -f \"$fullindexprefix\" -b $maxdocsize " .
418 "-$index_level -m 32 -s 0 -G -t 10 -N1 -M $maxnumeric $osextra")) {
419 print STDERR "<FatalError name='NoRunMGPasses'/>\n</Stage>\n" if $self->{'gli'};
420 die "mgbuilder::build_index - couldn't run $mg_passes_exe\n";
421 }
422 }
423
424 # set up the document processor
425 $self->{'buildproc'}->set_output_handle ($handle);
426 $self->{'buildproc'}->set_mode ('text');
427 $self->{'buildproc'}->set_index ($index, $indexexparr);
428 $self->{'buildproc'}->set_index_languages ($languagemetadata, $langarr) if (defined $language);
429 $self->{'buildproc'}->set_indexing_text (1);
430 $self->{'buildproc'}->set_store_text(1);
431
432 $self->{'buildproc'}->reset();
433 &plugin::read ($self->{'pluginfo'}, $self->{'source_dir'},
434 "", {}, {}, $self->{'buildproc'}, $self->{'maxdocs'},0, $self->{'gli'});
435 close ($handle) unless $self->{'debug'};
436
437 $self->print_stats();
438
439 # now we check to see if the required files have been produced - if not we quit building this index so the whole process doesn't crap out.
440 # we check on the .id file - index dictionary
441 my $dict_file = "$fullindexprefix.id";
442 if (!-e $dict_file) {
443 print $outhandle "mgbuilder::build_index - Couldn't create index $index\n";
444 $self->{'notbuilt'}->{$index}=1;
445 return;
446 }
447 if (!$self->{'debug'}) {
448 # create the perfect hash function
449 if (!-e "$mg_perf_hash_build_exe") {
450 print STDERR "<FatalError name='NoRunMGHash'/>\n</Stage>\n" if $self->{'gli'};
451 die "mgbuilder::build_index - couldn't run $mg_perf_hash_build_exe\n";
452 }
453
454 my $hash_cmd = "mg_perf_hash_build$exe -f \"$fullindexprefix\" $osextra";
455 print $outhandle "\ncmd: $hash_cmd\n" if ($self->{'verbosity'} >= 4);
456 my $hash_status = system ($hash_cmd);
457 print $outhandle "\nstatus from running hash_cmd: $hash_status\n" if ($self->{'verbosity'} >= 4);
458
459 if (!-e "$mg_passes_exe" ||
460 !open ($handle, "| mg_passes$exe -f \"$fullindexprefix\" -b $maxdocsize " .
461 "-$index_level -c 3 -G -t 10 -N2 -M $maxnumeric $osextra")) {
462 print STDERR "<FatalError name='NoRunMGPasses'/>\n</Stage>\n" if $self->{'gli'};
463 die "mgbuilder::build_index - couldn't run $mg_passes_exe\n";
464 }
465 }
466
467 # invert the text
468 print $outhandle "\n inverting the text\n" if ($self->{'verbosity'} >= 1);
469 print STDERR "<Phase name='InvertingText'/>\n" if $self->{'gli'};
470
471 $self->{'buildproc'}->set_output_handle ($handle);
472 $self->{'buildproc'}->reset();
473
474 &plugin::read ($self->{'pluginfo'}, $self->{'source_dir'},
475 "", {}, {}, $self->{'buildproc'}, $self->{'maxdocs'},0, $self->{'gli'});
476
477
478 $self->print_stats ();
479
480 if (!$self->{'debug'}) {
481
482 close ($handle);
483 my $passes_exit_status = $?;
484 print $outhandle "\nMG passes exit status $passes_exit_status\n" if ($self->{'verbosity'} >= 4);
485
486 # create the weights file
487 print $outhandle "\n create the weights file\n" if ($self->{'verbosity'} >= 1);
488 print STDERR "<Phase name='CreateTheWeights'/>\n" if $self->{'gli'};
489 if (!-e "$mg_weights_build_exe") {
490 print STDERR "<FatalError name='NoRunMGWeights'/>\n</Stage>\n" if $self->{'gli'};
491 die "mgbuilder::build_index - couldn't run $mg_weights_build_exe\n";
492 }
493 my $weights_cmd = "mg_weights_build$exe -f \"$fullindexprefix\" -t \"$fulltextprefix\" $osextra";
494 print $outhandle "\ncmd: $weights_cmd\n" if ($self->{'verbosity'} >= 4);
495 system ($weights_cmd);
496
497 # create 'on-disk' stemmed dictionary
498 print $outhandle "\n creating 'on-disk' stemmed dictionary\n" if ($self->{'verbosity'} >= 1);
499 print STDERR "<Phase name='CreateStemmedDic'/>\n" if $self->{'gli'};
500 if (!-e "$mg_invf_dict_exe") {
501 print STDERR "<FatalError name='NoRunMGInvf'/>\n</Stage>\n" if $self->{'gli'};
502 die "mgbuilder::build_index - couldn't run $mg_invf_dict_exe\n";
503 }
504 system ("mg_invf_dict$exe -f \"$fullindexprefix\" $osextra");
505
506
507 # creates stem index files for the various stemming methods
508 print $outhandle "\n creating stem indexes\n" if ($self->{'verbosity'} >= 1);
509 print STDERR "<Phase name='CreatingStemIndx'/>\n" if $self->{'gli'};
510 if (!-e "$mg_stem_idx_exe") {
511 print STDERR "<FatalError name='NoRunMGStem'/>\n</Stage>\n" if $self->{'gli'};
512 die "mgbuilder::build_index - couldn't run $mg_stem_idx_exe\n";
513 }
514 # currently mg wont work if we don't generate all the stem idexes
515 # so we generate them whatever, but don't advertise the fact
516 #if ($self->{'casefold'}) {
517 system ("mg_stem_idx$exe -b 4096 -s1 -f \"$fullindexprefix\" $osextra");
518 #}
519 #if ($self->{'stem'}) {
520 system ("mg_stem_idx$exe -b 4096 -s2 -f \"$fullindexprefix\" $osextra");
521 #}
522 #if ($self->{'casefold'} && $self->{'stem'}) {
523 system ("mg_stem_idx$exe -b 4096 -s3 -f \"$fullindexprefix\" $osextra");
524 #}
525
526 # remove unwanted files
527 my $tmpdir = &FileUtils::filenameConcatenate($self->{'build_dir'}, $indexdir);
528 opendir (DIR, $tmpdir) || die
529 "mgbuilder::build_index - couldn't read directory $tmpdir\n";
530 foreach my $file (readdir(DIR)) {
531 next if $file =~ /^\./;
532 my ($suffix) = $file =~ /\.([^\.]+)$/;
533 if (defined $suffix && !defined $wanted_index_files{$suffix}) {
534 # delete it!
535 print $outhandle "deleting $file\n" if $self->{'verbosity'} > 2;
536 &FileUtils::removeFiles (&FileUtils::filenameConcatenate($tmpdir, $file));
537 }
538 }
539 closedir (DIR);
540 }
541 print STDERR "</Stage>\n" if $self->{'gli'};
542}
543
544sub build_cfg_extra {
545 my $self = shift(@_);
546 my ($build_cfg) = @_;
547
548 # get additional stats from mg
549 my $exedir = "$ENV{'GSDLHOME'}/bin/$ENV{'GSDLOS'}";
550 my $exe = &util::get_os_exe ();
551 my $mgstat_exe = &FileUtils::filenameConcatenate($exedir, "mgstat$exe");
552
553 my $collect_tail = &util::get_dirsep_tail($self->{'collection'});
554 my $input_file = &FileUtils::filenameConcatenate("text", $collect_tail);
555 if (!-e "$mgstat_exe" || !open (PIPEIN, "mgstat$exe -d \"$self->{'build_dir'}\" -f \"$input_file\" |")) {
556 my $outhandle = $self->{'outhandle'};
557 print $outhandle "Warning: Couldn't open pipe to $mgstat_exe to get additional stats\n";
558 } else {
559 my $line = "";
560 while (defined ($line = <PIPEIN>)) {
561 if ($line =~ /^Words in collection \[dict\]\s+:\s+(\d+)/) {
562 ($build_cfg->{'numwords'}) = $1;
563 } elsif ($line =~ /^Documents\s+:\s+(\d+)/) {
564 ($build_cfg->{'numsections'}) = $1;
565 }
566 }
567 close PIPEIN;
568 }
569}
570
5711;
572
573
574
Note: See TracBrowser for help on using the repository browser.