View | Details | Raw Unified | Return to bug 29921
Collapse All | Expand All

(-)a/Koha/BiblioUtils.pm (-4 / +10 lines)
Lines 125-139 records instead of all. Link Here
125
sub get_all_biblios_iterator {
125
sub get_all_biblios_iterator {
126
    my ($self, %options) = @_;
126
    my ($self, %options) = @_;
127
127
128
    my $search_terms = {};
128
    my @search_terms;
129
    my $search_options = { columns => [qw/ biblionumber /] };
130
129
    my ($slice_modulo, $slice_count);
131
    my ($slice_modulo, $slice_count);
130
    if ($options{slice}) {
132
    if ($options{slice}) {
131
        $slice_count = $options{slice}->{count};
133
        $slice_count = $options{slice}->{count};
132
        $slice_modulo = $options{slice}->{index};
134
        $slice_modulo = $options{slice}->{index};
133
        $search_terms = \[ 'mod(biblionumber, ?) = ?', $slice_count, $slice_modulo ];
135
        push @search_terms, \[ 'mod(biblionumber, ?) = ?', $slice_count, $slice_modulo ];
136
    }
137
138
    if ($options{modified_since}) {
139
        $search_options->{join} = 'biblio_metadatas';
140
        push @search_terms, { 'biblio_metadatas.timestamp' => { '>=', $options{modified_since} } };
134
    }
141
    }
135
142
136
    my $search_options = { columns => [qw/ biblionumber /] };
137
    if ( $options{desc} ){
143
    if ( $options{desc} ){
138
        $search_options->{order_by}  = { -desc => 'biblionumber' };
144
        $search_options->{order_by}  = { -desc => 'biblionumber' };
139
    }
145
    }
Lines 142-148 sub get_all_biblios_iterator { Link Here
142
    my $schema   = $database->schema();
148
    my $schema   = $database->schema();
143
    my $rs =
149
    my $rs =
144
      $schema->resultset('Biblio')->search(
150
      $schema->resultset('Biblio')->search(
145
        $search_terms,
151
        [ -and => \@search_terms ],
146
        $search_options );
152
        $search_options );
147
    my $next_func = sub {
153
    my $next_func = sub {
148
        # Warn and skip bad records, otherwise we break the loop
154
        # Warn and skip bad records, otherwise we break the loop
(-)a/Koha/MetadataRecord/Authority.pm (-11 / +9 lines)
Lines 175-196 records instead of all. Link Here
175
sub get_all_authorities_iterator {
175
sub get_all_authorities_iterator {
176
    my ($self, %options) = @_;
176
    my ($self, %options) = @_;
177
177
178
    my $search_terms = {
178
    my @search_terms = ( { marcxml => { '!=', undef } } );
179
        marcxml => { '!=', undef }
179
    my $search_options->{columns} = [qw/ authid /];
180
    };
180
181
    my ($slice_modulo, $slice_count);
181
    my ($slice_modulo, $slice_count);
182
    if ($options{slice}) {
182
    if ($options{slice}) {
183
        $slice_count = $options{slice}->{count};
183
        $slice_count = $options{slice}->{count};
184
        $slice_modulo = $options{slice}->{index};
184
        $slice_modulo = $options{slice}->{index};
185
        $search_terms = {
185
        push @search_terms, \[ 'mod(authid, ?) = ?', $slice_count, $slice_modulo ];
186
            '-and' => [
186
    }
187
                %{$search_terms},
187
188
                \[ 'mod(authid, ?) = ?', $slice_count, $slice_modulo ]
188
    if ($options{modified_since}) {
189
            ]
189
        push @search_terms, { 'modification_time' => { '>=', $options{modified_since} } };
190
        };
191
    }
190
    }
192
191
193
    my $search_options->{columns} = [qw/ authid /];
194
    if ($options{desc}) {
192
    if ($options{desc}) {
195
        $search_options->{order_by} = { -desc => 'authid' };
193
        $search_options->{order_by} = { -desc => 'authid' };
196
    }
194
    }
Lines 199-205 sub get_all_authorities_iterator { Link Here
199
    my $schema   = $database->schema();
197
    my $schema   = $database->schema();
200
    my $rs =
198
    my $rs =
201
      $schema->resultset('AuthHeader')->search(
199
      $schema->resultset('AuthHeader')->search(
202
        $search_terms,
200
        [ -and => \@search_terms ],
203
        $search_options);
201
        $search_options);
204
    my $next_func = sub {
202
    my $next_func = sub {
205
        # Warn and skip bad records, otherwise we break the loop
203
        # Warn and skip bad records, otherwise we break the loop
(-)a/misc/search_tools/rebuild_elasticsearch.pl (-1 / +12 lines)
Lines 34-39 B<rebuild_elasticsearch.pl> Link Here
34
[B<--desc>]
34
[B<--desc>]
35
[B<-bn|--bnumber>]
35
[B<-bn|--bnumber>]
36
[B<-ai|--authid>]
36
[B<-ai|--authid>]
37
[B<--modified-since=DATETIME>]
37
[B<-p|--processes>]
38
[B<-p|--processes>]
38
[B<-v|--verbose>]
39
[B<-v|--verbose>]
39
[B<-h|--help>]
40
[B<-h|--help>]
Lines 87-92 repeated. Link Here
87
Only index the supplied authority id, mostly for testing purposes. May be
88
Only index the supplied authority id, mostly for testing purposes. May be
88
repeated.
89
repeated.
89
90
91
=item B<--modified-since=DATETIME>
92
93
Only index records modified since supplied datetime. It cannot be used with
94
--bnumber or --authid options.
95
90
=item B<-p|--processes>
96
=item B<-p|--processes>
91
97
92
Number of processes to use for indexing. This can be used to do more indexing
98
Number of processes to use for indexing. This can be used to do more indexing
Lines 128-133 my $verbose = 0; Link Here
128
my $commit = 5000;
134
my $commit = 5000;
129
my ($delete, $reset, $help, $man, $processes);
135
my ($delete, $reset, $help, $man, $processes);
130
my ($index_biblios, $index_authorities);
136
my ($index_biblios, $index_authorities);
137
my $modified_since;
131
my (@biblionumbers,@authids);
138
my (@biblionumbers,@authids);
132
my $desc;
139
my $desc;
133
140
Lines 142-147 GetOptions( Link Here
142
    'desc'          => \$desc,
149
    'desc'          => \$desc,
143
    'bn|bnumber=i'  => \@biblionumbers,
150
    'bn|bnumber=i'  => \@biblionumbers,
144
    'ai|authid=i'   => \@authids,
151
    'ai|authid=i'   => \@authids,
152
    'modified-since=s' => \$modified_since,
145
    'p|processes=i' => \$processes,
153
    'p|processes=i' => \$processes,
146
    'v|verbose+'    => \$verbose,
154
    'v|verbose+'    => \$verbose,
147
    'h|help'        => \$help,
155
    'h|help'        => \$help,
Lines 193-198 if ($slice_count > 1) { Link Here
193
    $iterator_options{slice} = { index => $slice_index, count => $slice_count };
201
    $iterator_options{slice} = { index => $slice_index, count => $slice_count };
194
}
202
}
195
203
204
if ($modified_since) {
205
    $iterator_options{modified_since} = $modified_since;
206
}
207
196
if( $desc ){
208
if( $desc ){
197
    $iterator_options{desc} = 1;
209
    $iterator_options{desc} = 1;
198
}
210
}
199
- 

Return to bug 29921