Lines 28-33
rebuild_elastic_search.pl - inserts records from a Koha database into Elasticsea
Link Here
|
28 |
B<rebuild_elastic_search.pl> |
28 |
B<rebuild_elastic_search.pl> |
29 |
[B<-c|--commit>=C<count>] |
29 |
[B<-c|--commit>=C<count>] |
30 |
[B<-v|--verbose>] |
30 |
[B<-v|--verbose>] |
|
|
31 |
[B<-d|--delete>] |
32 |
[B<-a|--authorities>] |
33 |
[B<-b|--biblios>] |
34 |
[B<-bn|--bnnumber>] |
35 |
[B<--length>] |
36 |
[B<--offset>] |
31 |
[B<-h|--help>] |
37 |
[B<-h|--help>] |
32 |
[B<--man>] |
38 |
[B<--man>] |
33 |
|
39 |
|
Lines 64-69
Only index the supplied biblionumber, mostly for testing purposes. May be
Link Here
|
64 |
repeated. This also applies to authorities via authid, so if you're using it, |
70 |
repeated. This also applies to authorities via authid, so if you're using it, |
65 |
you probably only want to do one or the other at a time. |
71 |
you probably only want to do one or the other at a time. |
66 |
|
72 |
|
|
|
73 |
=item B<--offset> |
74 |
|
75 |
Specify the row number for the first row to be indexed. |
76 |
With this option you have to choose between biblios (-b) or authorities (-a). |
77 |
|
78 |
=item B<--length> |
79 |
|
80 |
Specify the number of rows to be indexed. |
81 |
With this option you have to choose between biblios (-b) or authorities (-a). |
82 |
|
67 |
=item B<-v|--verbose> |
83 |
=item B<-v|--verbose> |
68 |
|
84 |
|
69 |
By default, this program only emits warnings and errors. This makes it talk |
85 |
By default, this program only emits warnings and errors. This makes it talk |
Lines 98-113
my $commit = 5000;
Link Here
|
98 |
my ($delete, $help, $man); |
114 |
my ($delete, $help, $man); |
99 |
my ($index_biblios, $index_authorities); |
115 |
my ($index_biblios, $index_authorities); |
100 |
my (@biblionumbers); |
116 |
my (@biblionumbers); |
|
|
117 |
my ($offset, $length); |
101 |
|
118 |
|
102 |
$|=1; # flushes output |
119 |
$|=1; # flushes output |
103 |
|
120 |
|
104 |
GetOptions( |
121 |
GetOptions( |
105 |
'c|commit=i' => \$commit, |
122 |
'c|commit=i' => \$commit, |
106 |
'd|delete' => \$delete, |
123 |
'd|delete' => \$delete, |
107 |
'a|authorities' => \$index_authorities, |
124 |
'a|authorities' => \$index_authorities, |
108 |
'b|biblios' => \$index_biblios, |
125 |
'b|biblios' => \$index_biblios, |
109 |
'bn|bnumber=i' => \@biblionumbers, |
126 |
'bn|bnumber=i' => \@biblionumbers, |
110 |
'v|verbose+' => \$verbose, |
127 |
'v|verbose+' => \$verbose, |
|
|
128 |
'offset=i' => \$offset, |
129 |
'length=i' => \$length, |
111 |
'h|help' => \$help, |
130 |
'h|help' => \$help, |
112 |
'man' => \$man, |
131 |
'man' => \$man, |
113 |
); |
132 |
); |
Lines 120-125
unless ($index_authorities || $index_biblios) {
Link Here
|
120 |
pod2usage(1) if $help; |
139 |
pod2usage(1) if $help; |
121 |
pod2usage( -exitstatus => 0, -verbose => 2 ) if $man; |
140 |
pod2usage( -exitstatus => 0, -verbose => 2 ) if $man; |
122 |
|
141 |
|
|
|
142 |
if ($offset || $length){ |
143 |
if ( $index_biblios && $index_authorities){ |
144 |
printf "With options --offset or --length, you have to choose between biblios (-b) or authorities (-a)." . "\n"; |
145 |
pod2usage(1); |
146 |
} |
147 |
} |
148 |
|
123 |
sanity_check(); |
149 |
sanity_check(); |
124 |
|
150 |
|
125 |
my $next; |
151 |
my $next; |
Lines 131-138
if ($index_biblios) {
Link Here
|
131 |
return () unless defined $r; |
157 |
return () unless defined $r; |
132 |
return ($r, Koha::BiblioUtils->get_from_biblionumber($r, item_data => 1 )); |
158 |
return ($r, Koha::BiblioUtils->get_from_biblionumber($r, item_data => 1 )); |
133 |
}; |
159 |
}; |
134 |
} else { |
160 |
} else { |
135 |
my $records = Koha::BiblioUtils->get_all_biblios_iterator(); |
161 |
my $records = Koha::BiblioUtils->get_all_biblios_iterator($offset, $length); |
136 |
$next = sub { |
162 |
$next = sub { |
137 |
$records->next(); |
163 |
$records->next(); |
138 |
} |
164 |
} |
Lines 149-155
if ($index_authorities) {
Link Here
|
149 |
return ($r, $a->record); |
175 |
return ($r, $a->record); |
150 |
}; |
176 |
}; |
151 |
} else { |
177 |
} else { |
152 |
my $records = Koha::MetadataRecord::Authority->get_all_authorities_iterator(); |
178 |
my $records = Koha::MetadataRecord::Authority->get_all_authorities_iterator($offset, $length); |
153 |
$next = sub { |
179 |
$next = sub { |
154 |
$records->next(); |
180 |
$records->next(); |
155 |
} |
181 |
} |
156 |
- |
|
|