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

(-)a/Koha/BiblioUtils.pm (-2 / +7 lines)
Lines 111-121 The iterator is a Koha::MetadataIterator object. Link Here
111
=cut
111
=cut
112
112
113
sub get_all_biblios_iterator {
113
sub get_all_biblios_iterator {
114
    my ($class, $offset, $length) = @_;
114
    my $database = Koha::Database->new();
115
    my $database = Koha::Database->new();
115
    my $schema   = $database->schema();
116
    my $schema   = $database->schema();
117
116
    my $rs =
118
    my $rs =
117
      $schema->resultset('Biblio')->search( {},
119
        $schema->resultset('Biblio')->search( {},{
118
        { columns => [qw/ biblionumber /] } );
120
            columns => [qw/ biblionumber / ] ,
121
            offset => $offset ,
122
            rows => $length });
123
119
    my $next_func = sub {
124
    my $next_func = sub {
120
        # Warn and skip bad records, otherwise we break the loop
125
        # Warn and skip bad records, otherwise we break the loop
121
        while (1) {
126
        while (1) {
(-)a/Koha/MetadataRecord/Authority.pm (-2 / +6 lines)
Lines 161-171 The iterator is a Koha::MetadataIterator object. Link Here
161
=cut
161
=cut
162
162
163
sub get_all_authorities_iterator {
163
sub get_all_authorities_iterator {
164
    my ($class, $offset, $length) = @_;
164
    my $database = Koha::Database->new();
165
    my $database = Koha::Database->new();
165
    my $schema   = $database->schema();
166
    my $schema   = $database->schema();
166
    my $rs =
167
    my $rs =
167
      $schema->resultset('AuthHeader')->search( { marcxml => { '!=', undef } },
168
        $schema->resultset('AuthHeader')->search( { marcxml => { '!=', undef } },{
168
        { columns => [qw/ authid authtypecode marcxml /] } );
169
            columns => [qw/ authid authtypecode marcxml /],
170
            offset => $offset,
171
            rows => $length });
172
169
    my $next_func = sub {
173
    my $next_func = sub {
170
        my $row = $rs->next();
174
        my $row = $rs->next();
171
        return if !$row;
175
        return if !$row;
(-)a/misc/search_tools/rebuild_elastic_search.pl (-7 / +18 lines)
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,
64
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.
65
you probably only want to do one or the other at a time.
66
66
67
=item B<--offset>
68
69
Specify the row number for the first row to be indexed.
70
71
=item B<--length>
72
73
Specify the number of rows to be indexed.
74
75
67
=item B<-v|--verbose>
76
=item B<-v|--verbose>
68
77
69
By default, this program only emits warnings and errors. This makes it talk
78
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);
107
my ($delete, $help, $man);
99
my ($index_biblios, $index_authorities);
108
my ($index_biblios, $index_authorities);
100
my (@biblionumbers);
109
my (@biblionumbers);
110
my ($offset, $length);
101
111
102
$|=1; # flushes output
112
$|=1; # flushes output
103
113
104
GetOptions(
114
GetOptions(
105
    'c|commit=i'       => \$commit,
115
    'c|commit=i'       => \$commit,
106
    'd|delete'         => \$delete,
116
    'd|delete'         => \$delete,
107
    'a|authorities' => \$index_authorities,
117
    'a|authorities'    => \$index_authorities,
108
    'b|biblios' => \$index_biblios,
118
    'b|biblios'        => \$index_biblios,
109
    'bn|bnumber=i' => \@biblionumbers,
119
    'bn|bnumber=i'     => \@biblionumbers,
110
    'v|verbose+'       => \$verbose,
120
    'v|verbose+'       => \$verbose,
121
    'offset=i'         => \$offset,
122
    'length=i'         => \$length,
111
    'h|help'           => \$help,
123
    'h|help'           => \$help,
112
    'man'              => \$man,
124
    'man'              => \$man,
113
);
125
);
Lines 131-138 if ($index_biblios) { Link Here
131
            return () unless defined $r;
143
            return () unless defined $r;
132
            return ($r, Koha::BiblioUtils->get_from_biblionumber($r, item_data => 1 ));
144
            return ($r, Koha::BiblioUtils->get_from_biblionumber($r, item_data => 1 ));
133
        };
145
        };
134
    } else {
146
    }  else {
135
        my $records = Koha::BiblioUtils->get_all_biblios_iterator();
147
        my $records = Koha::BiblioUtils->get_all_biblios_iterator($offset, $length);
136
        $next = sub {
148
        $next = sub {
137
            $records->next();
149
            $records->next();
138
        }
150
        }
Lines 149-155 if ($index_authorities) { Link Here
149
            return ($r, $a->record);
161
            return ($r, $a->record);
150
        };
162
        };
151
    } else {
163
    } else {
152
        my $records = Koha::MetadataRecord::Authority->get_all_authorities_iterator();
164
        my $records = Koha::MetadataRecord::Authority->get_all_authorities_iterator($offset, $length);
153
        $next = sub {
165
        $next = sub {
154
            $records->next();
166
            $records->next();
155
        }
167
        }
156
- 

Return to bug 20384