[27228] | 1 | ###########################################################################
|
---|
| 2 | #
|
---|
| 3 | # parallellucenebuilder.pm -- perl wrapper for building index with Lucene
|
---|
| 4 | # extended to support parallel building in terms of controlling index name
|
---|
| 5 | # and level built, and generating a 'recipe' for indexing (making use of
|
---|
| 6 | # former)
|
---|
| 7 | #
|
---|
| 8 | # A component of the Greenstone digital library software
|
---|
| 9 | # from the New Zealand Digital Library Project at the
|
---|
| 10 | # University of Waikato, New Zealand.
|
---|
| 11 | #
|
---|
| 12 | # Copyright (C) 2013 New Zealand Digital Library Project
|
---|
| 13 | #
|
---|
| 14 | # This program is free software; you can redistribute it and/or modify
|
---|
| 15 | # it under the terms of the GNU General Public License as published by
|
---|
| 16 | # the Free Software Foundation; either version 2 of the License, or
|
---|
| 17 | # (at your option) any later version.
|
---|
| 18 | #
|
---|
| 19 | # This program is distributed in the hope that it will be useful,
|
---|
| 20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 22 | # GNU General Public License for more details.
|
---|
| 23 | #
|
---|
| 24 | # You should have received a copy of the GNU General Public License
|
---|
| 25 | # along with this program; if not, write to the Free Software
|
---|
| 26 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
| 27 | #
|
---|
| 28 | ###########################################################################
|
---|
| 29 |
|
---|
[27234] | 30 | # @author David Bainbridge and Katherine Don, Waikato DL Research group
|
---|
| 31 | # @author John Rowe, DL Consulting Ltd.
|
---|
| 32 | # @author John Thompson, DL Consulting Ltd.
|
---|
| 33 | # @author John Thompson [jmt12], Waikato DL Research group
|
---|
| 34 |
|
---|
[27228] | 35 | package parallellucenebuilder;
|
---|
| 36 |
|
---|
| 37 | use lucenebuilder;
|
---|
| 38 | use parallelmgppbuilder;
|
---|
| 39 | use strict;
|
---|
| 40 |
|
---|
| 41 | sub BEGIN
|
---|
| 42 | {
|
---|
| 43 | @parallellucenebuilder::ISA = ('lucenebuilder', 'parallelmgppbuilder');
|
---|
| 44 | }
|
---|
| 45 |
|
---|
[27234] | 46 | # /** @function new()
|
---|
| 47 | # */
|
---|
[27228] | 48 | sub new
|
---|
| 49 | {
|
---|
| 50 | my $class = shift(@_);
|
---|
| 51 | my $self = new lucenebuilder(@_);
|
---|
| 52 | return bless($self, $class);
|
---|
| 53 | }
|
---|
[27234] | 54 | # /** new() **/
|
---|
[27228] | 55 |
|
---|
[27234] | 56 | # /** @function prepareIndexRecipe()
|
---|
| 57 | # * The three main 'modes' in Lucene builds are completely independent, while
|
---|
| 58 | # * index building can be further split by level
|
---|
| 59 | # * @param $self
|
---|
| 60 | # * @param $collection
|
---|
| 61 | # * @param $recipe a reference to an array of recipe 'steps'
|
---|
| 62 | # * @author jmt12
|
---|
| 63 | # */
|
---|
| 64 | sub prepareIndexRecipe
|
---|
[27228] | 65 | {
|
---|
[27234] | 66 | my ($self, $collection, $recipe) = @_;
|
---|
[27228] | 67 | my $outhandle = $self->{'outhandle'};
|
---|
| 68 | my $verbosity = $self->{'verbosity'};
|
---|
| 69 | # 1. Compressing the text
|
---|
[27234] | 70 | push(@{$recipe}, {'command'=>'buildcol.pl -keepold -verbosity ' . $verbosity . ' -mode compress_text ' . $collection});
|
---|
[27228] | 71 | # 2. Info database building
|
---|
[27234] | 72 | push(@{$recipe}, {'command'=>'buildcol.pl -keepold -verbosity ' . $verbosity . ' -mode infodb ' . $collection});
|
---|
[27228] | 73 | # 3. Now one command each for each level of index required
|
---|
| 74 | foreach my $level (keys %{$self->{'levels'}})
|
---|
| 75 | {
|
---|
[27234] | 76 | push(@{$recipe}, {'command'=>'buildcol.pl -keepold -verbosity ' . $verbosity . ' -mode build_index -indexlevel ' . $level . ' ' . $collection});
|
---|
[27228] | 77 | }
|
---|
| 78 | # Complete!
|
---|
| 79 | }
|
---|
[27234] | 80 | # /** prepareIndexRecipe() **/
|
---|
[27228] | 81 |
|
---|
| 82 | 1;
|
---|
| 83 |
|
---|
| 84 |
|
---|