source: gs2-extensions/parallel-building/trunk/src/perllib/parallellucenebuilder.pm@ 27234

Last change on this file since 27234 was 27234, checked in by jmt12, 11 years ago

renamed prepare_build_recipe() to the more meaningful prepareIndexRecipe() - plus I prefer java formatting

File size: 2.8 KB
Line 
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
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
35package parallellucenebuilder;
36
37use lucenebuilder;
38use parallelmgppbuilder;
39use strict;
40
41sub BEGIN
42{
43 @parallellucenebuilder::ISA = ('lucenebuilder', 'parallelmgppbuilder');
44}
45
46# /** @function new()
47# */
48sub new
49{
50 my $class = shift(@_);
51 my $self = new lucenebuilder(@_);
52 return bless($self, $class);
53}
54# /** new() **/
55
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# */
64sub prepareIndexRecipe
65{
66 my ($self, $collection, $recipe) = @_;
67 my $outhandle = $self->{'outhandle'};
68 my $verbosity = $self->{'verbosity'};
69 # 1. Compressing the text
70 push(@{$recipe}, {'command'=>'buildcol.pl -keepold -verbosity ' . $verbosity . ' -mode compress_text ' . $collection});
71 # 2. Info database building
72 push(@{$recipe}, {'command'=>'buildcol.pl -keepold -verbosity ' . $verbosity . ' -mode infodb ' . $collection});
73 # 3. Now one command each for each level of index required
74 foreach my $level (keys %{$self->{'levels'}})
75 {
76 push(@{$recipe}, {'command'=>'buildcol.pl -keepold -verbosity ' . $verbosity . ' -mode build_index -indexlevel ' . $level . ' ' . $collection});
77 }
78 # Complete!
79}
80# /** prepareIndexRecipe() **/
81
821;
83
84
Note: See TracBrowser for help on using the repository browser.