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

(-)a/Koha/Authority.pm (-31 / +115 lines)
Lines 41-64 use Koha::Util::MARC; Link Here
41
41
42
use base qw(Koha::MetadataRecord);
42
use base qw(Koha::MetadataRecord);
43
43
44
__PACKAGE__->mk_accessors(qw( authid authtype ));
44
__PACKAGE__->mk_accessors(qw( authid authtype record idnumber datatype ));
45
45
46
=head2 new
46
=head2 new
47
47
48
    my $auth = Koha::Authority->new($record);
48
    my $auth = Koha::Authority->new($record, [$authid]);
49
49
50
Create a new Koha::Authority object based on the provided record.
50
Create a new Koha::Authority object based on the provided record and optional
51
authority ID.
51
52
52
=cut
53
=cut
53
54
54
sub new {
55
sub new {
55
    my $class = shift;
56
    my $class    = shift;
56
    my $record = shift;
57
    my $record   = shift;
58
    my $authid   = shift;
59
    my $authtype = shift;
57
60
58
    my $self = $class->SUPER::new(
61
    my $self = $class->SUPER::new(
59
        {
62
        {
60
            'record' => $record,
63
            'record'   => $record,
61
            'schema' => lc C4::Context->preference("marcflavour")
64
            'schema'   => lc C4::Context->preference("marcflavour"),
65
            'idnumber' => $authid,
66
            'datatype' => 'authority',
67
            'authtype' => $authtype,
62
        }
68
        }
63
    );
69
    );
64
70
Lines 66-72 sub new { Link Here
66
    return $self;
72
    return $self;
67
}
73
}
68
74
69
70
=head2 get_from_authid
75
=head2 get_from_authid
71
76
72
    my $auth = Koha::Authority->get_from_authid($authid);
77
    my $auth = Koha::Authority->get_from_authid($authid);
Lines 79-94 unfortunate but unavoidable fact. Link Here
79
=cut
84
=cut
80
85
81
sub get_from_authid {
86
sub get_from_authid {
82
    my $class = shift;
87
    my $class       = shift;
83
    my $authid = shift;
88
    my $authid      = shift;
84
    my $marcflavour = lc C4::Context->preference("marcflavour");
89
    my $marcflavour = lc C4::Context->preference("marcflavour");
85
90
86
    my $dbh=C4::Context->dbh;
91
    my $dbh = C4::Context->dbh;
87
    my $sth=$dbh->prepare("select authtypecode, marcxml from auth_header where authid=?");
92
    my $sth = $dbh->prepare(
93
        "select authtypecode, marcxml from auth_header where authid=?");
88
    $sth->execute($authid);
94
    $sth->execute($authid);
89
    my ($authtypecode, $marcxml) = $sth->fetchrow;
95
    my ( $authtypecode, $marcxml ) = $sth->fetchrow;
90
    my $record=eval {MARC::Record->new_from_xml(StripNonXmlChars($marcxml),'UTF-8',
96
    my $record = eval {
91
        (C4::Context->preference("marcflavour") eq "UNIMARC"?"UNIMARCAUTH":C4::Context->preference("marcflavour")))};
97
        MARC::Record->new_from_xml(
98
            StripNonXmlChars($marcxml),
99
            'UTF-8',
100
            (
101
                C4::Context->preference("marcflavour") eq "UNIMARC"
102
                ? "UNIMARCAUTH"
103
                : C4::Context->preference("marcflavour")
104
            )
105
        );
106
    };
92
    return if ($@);
107
    return if ($@);
93
    $record->encoding('UTF-8');
108
    $record->encoding('UTF-8');
94
109
Lines 99-108 sub get_from_authid { Link Here
99
    require C4::AuthoritiesMarc;
114
    require C4::AuthoritiesMarc;
100
    $authtypecode ||= C4::AuthoritiesMarc::GuessAuthTypeCode($record);
115
    $authtypecode ||= C4::AuthoritiesMarc::GuessAuthTypeCode($record);
101
116
102
    my $self = $class->SUPER::new( { authid => $authid,
117
    my $self = $class->SUPER::new(
103
                                     authtype => $authtypecode,
118
        {
104
                                     schema => $marcflavour,
119
            authid   => $authid,
105
                                     record => $record });
120
            authtype => $authtypecode,
121
            schema   => $marcflavour,
122
            record   => $record
123
        }
124
    );
106
125
107
    bless $self, $class;
126
    bless $self, $class;
108
    return $self;
127
    return $self;
Lines 117-132 Create the Koha::Authority object associated with the provided authid. Link Here
117
=cut
136
=cut
118
137
119
sub get_from_breeding {
138
sub get_from_breeding {
120
    my $class = shift;
139
    my $class            = shift;
121
    my $import_record_id = shift;
140
    my $import_record_id = shift;
122
    my $marcflavour = lc C4::Context->preference("marcflavour");
141
    my $marcflavour      = lc C4::Context->preference("marcflavour");
123
142
124
    my $dbh=C4::Context->dbh;
143
    my $dbh = C4::Context->dbh;
125
    my $sth=$dbh->prepare("select marcxml from import_records where import_record_id=? and record_type='auth';");
144
    my $sth = $dbh->prepare(
145
"select marcxml from import_records where import_record_id=? and record_type='auth';"
146
    );
126
    $sth->execute($import_record_id);
147
    $sth->execute($import_record_id);
127
    my $marcxml = $sth->fetchrow;
148
    my $marcxml = $sth->fetchrow;
128
    my $record=eval {MARC::Record->new_from_xml(StripNonXmlChars($marcxml),'UTF-8',
149
    my $record  = eval {
129
        (C4::Context->preference("marcflavour") eq "UNIMARC"?"UNIMARCAUTH":C4::Context->preference("marcflavour")))};
150
        MARC::Record->new_from_xml(
151
            StripNonXmlChars($marcxml),
152
            'UTF-8',
153
            (
154
                C4::Context->preference("marcflavour") eq "UNIMARC"
155
                ? "UNIMARCAUTH"
156
                : C4::Context->preference("marcflavour")
157
            )
158
        );
159
    };
130
    return if ($@);
160
    return if ($@);
131
    $record->encoding('UTF-8');
161
    $record->encoding('UTF-8');
132
162
Lines 137-146 sub get_from_breeding { Link Here
137
    require C4::AuthoritiesMarc;
167
    require C4::AuthoritiesMarc;
138
    my $authtypecode = C4::AuthoritiesMarc::GuessAuthTypeCode($record);
168
    my $authtypecode = C4::AuthoritiesMarc::GuessAuthTypeCode($record);
139
169
140
    my $self = $class->SUPER::new( {
170
    my $self = $class->SUPER::new(
141
                                     schema => $marcflavour,
171
        {
142
                                     authtype => $authtypecode,
172
            schema   => $marcflavour,
143
                                     record => $record });
173
            authtype => $authtypecode,
174
            record   => $record
175
        }
176
    );
144
177
145
    bless $self, $class;
178
    bless $self, $class;
146
    return $self;
179
    return $self;
Lines 148-157 sub get_from_breeding { Link Here
148
181
149
sub authorized_heading {
182
sub authorized_heading {
150
    my ($self) = @_;
183
    my ($self) = @_;
151
    if ($self->schema =~ m/marc/) {
184
    if ( $self->schema =~ m/marc/ ) {
152
        return Koha::Util::MARC::getAuthorityAuthorizedHeading($self->record, $self->schema);
185
        return Koha::Util::MARC::getAuthorityAuthorizedHeading( $self->record,
186
            $self->schema );
153
    }
187
    }
154
    return;
188
    return;
155
}
189
}
156
190
191
=head2 get_all_authorities_iterator
192
193
    my $it = Koha::Authority->get_all_authorities_iterator();
194
195
This will provide an iterator object that will, one by one, provide the
196
Koha::Authority of each authority.
197
198
The iterator is a Koha::MetadataIterator object.
199
200
=cut
201
202
sub get_all_authorities_iterator {
203
    my $database = Koha::Database->new();
204
    my $schema   = $database->schema();
205
    my $rs =
206
      $schema->resultset('AuthHeader')->search( { marcxml => { '!=', undef } },
207
        { columns => [qw/ authid authtypecode marcxml /] } );
208
    my $next_func = sub {
209
        my $row = $rs->next();
210
        return undef if !$row;
211
        my $authid       = $row->authid;
212
        my $authtypecode = $row->authtypecode;
213
        my $marcxml      = $row->marcxml;
214
215
        my $record = eval {
216
            MARC::Record->new_from_xml(
217
                StripNonXmlChars($marcxml),
218
                'UTF-8',
219
                (
220
                    C4::Context->preference("marcflavour") eq "UNIMARC"
221
                    ? "UNIMARCAUTH"
222
                    : C4::Context->preference("marcflavour")
223
                )
224
            );
225
        };
226
        confess $@ if ($@);
227
        $record->encoding('UTF-8');
228
229
        # I'm not sure why we don't use the authtypecode from the database,
230
        # but this is how the original code does it.
231
        require C4::AuthoritiesMarc;
232
        $authtypecode = C4::AuthoritiesMarc::GuessAuthTypeCode($record);
233
234
        my $auth = __PACKAGE__->new( $record, $authid, $authtypecode );
235
236
        return $auth;
237
      };
238
      return Koha::MetadataIterator->new($next_func);
239
}
240
157
1;
241
1;
(-)a/Koha/Biblio.pm (-11 / +74 lines)
Lines 33-56 the new thing that should be used. Link Here
33
=cut
33
=cut
34
34
35
use C4::Biblio; # EmbedItemsInMarcBiblio
35
use C4::Biblio; # EmbedItemsInMarcBiblio
36
use Koha::Biblio::Iterator;
36
use Koha::MetadataIterator;
37
use Koha::Database;
37
use Koha::Database;
38
use Modern::Perl;
38
use Modern::Perl;
39
39
40
use base qw(Class::Accessor);
40
use base qw(Koha::MetadataRecord);
41
41
42
__PACKAGE__->mk_accessors(qw());
42
__PACKAGE__->mk_accessors(qw( record schema idnumber datatype ));
43
43
44
=head1 FUNCTIONS
44
=head1 FUNCTIONS
45
45
46
=head2 new
47
48
    my $biblio = Koha::Biblio->new($marc_record, [$biblionumber]);
49
50
Creates an instance of C<Koha::Biblio> based on the marc record. If known,
51
the biblionumber can be provided too.
52
53
=cut
54
55
sub new {
56
    my $class = shift;
57
    my $record = shift;
58
    my $biblionumber = shift;
59
60
    my $self = $class->SUPER::new(
61
        {
62
            'record'   => $record,
63
            'schema'   => lc C4::Context->preference("marcflavour"),
64
            'idnumber' => $biblionumber,
65
            'datatype' => 'biblio',
66
        }
67
    );
68
    bless $self, $class;
69
    return $self;
70
}
71
72
=head2 get_from_biblionumber
73
74
    my $biblio = Koha::Biblio->get_from_biblionumber($biblionumber, %options);
75
76
This will give you an instance of L<Koha::Biblio> that is the biblio that
77
you requested. 
78
79
Options are:
80
81
=over 4
82
83
=item C<$item_data>
84
85
If true, then the item data will be merged into the record when it's loaded.
86
87
=back
88
89
It will return C<undef> if the biblio doesn't exist.
90
91
=cut
92
93
sub get_from_biblionumber {
94
    my ($class, $bibnum, %options) = @_;
95
96
    my $marc = get_marc_biblio($bibnum, %options);
97
    return $class->new($marc, $bibnum);
98
}
99
46
=head2 get_all_biblios_iterator
100
=head2 get_all_biblios_iterator
47
101
48
    my $it = get_all_biblios_iterator();
102
    my $it = Koha::Biblio->get_all_biblios_iterator();
49
103
50
This will provide an iterator object that will, one by one, provide the
104
This will provide an iterator object that will, one by one, provide the
51
MARC::Record of each biblio. This will include the item data.
105
Koha::Biblio of each biblio. This will include the item data.
52
106
53
The iterator is a Koha::Biblio::Iterator object.
107
The iterator is a Koha::MetadataIterator object.
54
108
55
=cut
109
=cut
56
110
Lines 60-74 sub get_all_biblios_iterator { Link Here
60
    my $rs =
114
    my $rs =
61
      $schema->resultset('Biblioitem')->search( { marc => { '!=', undef } },
115
      $schema->resultset('Biblioitem')->search( { marc => { '!=', undef } },
62
        { columns => [qw/ biblionumber marc /] } );
116
        { columns => [qw/ biblionumber marc /] } );
63
    return Koha::Biblio::Iterator->new($rs, items => 1);
117
    my $next_func = sub {
118
        my $row = $rs->next();
119
        return undef if !$row;
120
        my $marc = MARC::Record->new_from_usmarc( $row->marc );
121
        my $bibnum = $row->get_column('biblionumber');
122
        C4::Biblio::EmbedItemsInMarcBiblio( $marc, $bibnum );
123
        return __PACKAGE__->new($marc, $bibnum);
124
    };
125
    return Koha::MetadataIterator->new($next_func);
64
}
126
}
65
127
66
=head2 get_marc_biblio
128
=head2 get_marc_biblio
67
129
68
    my $marc = get_marc_biblio($bibnum, %options);
130
    my $marc = Koha::Biblio->get_marc_biblio($bibnum, %options);
69
131
70
This fetches the MARC::Record for the given biblio number. Nothing is returned
132
This non-class function fetches the MARC::Record for the given biblio number.
71
if the biblionumber couldn't be found (or it somehow has no MARC data.)
133
Nothing is returned if the biblionumber couldn't be found (or it somehow has no
134
MARC data.)
72
135
73
Options are:
136
Options are:
74
137
Lines 83-89 If set to true, item data is embedded in the record. Default is to not do this. Link Here
83
=cut
146
=cut
84
147
85
sub get_marc_biblio {
148
sub get_marc_biblio {
86
    my ($class,$bibnum, %options) = @_;
149
    my ($class, $bibnum, %options) = @_;
87
150
88
    my $database = Koha::Database->new();
151
    my $database = Koha::Database->new();
89
    my $schema   = $database->schema();
152
    my $schema   = $database->schema();
(-)a/Koha/ElasticSearch.pm (-1 / +8 lines)
Lines 24-34 use Carp; Link Here
24
use Elasticsearch;
24
use Elasticsearch;
25
use Koha::Database;
25
use Koha::Database;
26
use Modern::Perl;
26
use Modern::Perl;
27
use Readonly;
27
28
28
use Data::Dumper;    # TODO remove
29
use Data::Dumper;    # TODO remove
29
30
30
__PACKAGE__->mk_ro_accessors(qw( index ));
31
__PACKAGE__->mk_ro_accessors(qw( index ));
31
32
33
# Constants to refer to the standard index names
34
Readonly our $BIBLIOS_INDEX     => 'biblios';
35
Readonly our $AUTHORITIES_INDEX => 'authorities';
36
32
=head1 NAME
37
=head1 NAME
33
38
34
Koha::ElasticSearch - Base module for things using elasticsearch
39
Koha::ElasticSearch - Base module for things using elasticsearch
Lines 290-296 sub _foreach_mapping { Link Here
290
    # TODO use a caching framework here
295
    # TODO use a caching framework here
291
    my $database = Koha::Database->new();
296
    my $database = Koha::Database->new();
292
    my $schema   = $database->schema();
297
    my $schema   = $database->schema();
293
    my $rs       = $schema->resultset('ElasticsearchMapping')->search();
298
    my $rs =
299
      $schema->resultset('ElasticsearchMapping')
300
      ->search( { indexname => $self->index } );
294
    for my $row ( $rs->all ) {
301
    for my $row ( $rs->all ) {
295
        $sub->(
302
        $sub->(
296
            $row->id,
303
            $row->id,
(-)a/Koha/MetadataIterator.pm (+74 lines)
Line 0 Link Here
1
package Koha::MetadataIterator;
2
3
# This contains an iterator over biblio and authority records
4
5
# Copyright 2014 Catalyst IT
6
#
7
# This file is part of Koha.
8
#
9
# Koha is free software; you can redistribute it and/or modify it under the
10
# terms of the GNU General Public License as published by the Free Software
11
# Foundation; either version 3 of the License, or (at your option) any later
12
# version.
13
#
14
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
15
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
17
#
18
# You should have received a copy of the GNU General Public License along
19
# with Koha; if not, write to the Free Software Foundation, Inc.,
20
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
22
=head1 NAME
23
24
Koha::MetadataIterator - iterates over records
25
26
=head1 DESCRIPTION
27
28
This provides a fairly generic iterator that will return records provided
29
by a function.
30
31
=head1 SYNOPSIS
32
33
    use Koha::MetadataIterator;
34
    my $next_func = sub {
35
        # something that'll return each record
36
    };
37
    my $iterator = Koha::MetadataIterator->new($next_func);
38
    while ( my $record = $iterator->next() ) {
39
        # do something with $record
40
    }
41
42
=head1 METHODS
43
44
=cut
45
46
use Modern::Perl;
47
48
=head2 new
49
50
    my $it = new($next_func);
51
52
Takes a function that will provide the next bit of data.
53
54
=cut
55
56
sub new {
57
    my ( $class, $next_func ) = @_;
58
59
    bless { next_func => $next_func, }, $class;
60
}
61
62
=head2 next()
63
64
Provides the next record.
65
66
=cut
67
68
sub next {
69
    my ($self) = @_;
70
71
    return $self->{next_func}->();
72
}
73
74
1;
(-)a/Koha/Schema/Result/ElasticsearchMapping.pm (-4 / +4 lines)
Lines 38-44 __PACKAGE__->table("elasticsearch_mapping"); Link Here
38
=head2 type
38
=head2 type
39
39
40
  data_type: 'varchar'
40
  data_type: 'varchar'
41
  is_nullable: 1
41
  is_nullable: 0
42
  size: 255
42
  size: 255
43
43
44
=head2 facet
44
=head2 facet
Lines 73-79 __PACKAGE__->add_columns( Link Here
73
  "mapping",
73
  "mapping",
74
  { data_type => "varchar", is_nullable => 1, size => 255 },
74
  { data_type => "varchar", is_nullable => 1, size => 255 },
75
  "type",
75
  "type",
76
  { data_type => "varchar", is_nullable => 1, size => 255 },
76
  { data_type => "varchar", is_nullable => 0, size => 255 },
77
  "facet",
77
  "facet",
78
  { data_type => "tinyint", default_value => 0, is_nullable => 1 },
78
  { data_type => "tinyint", default_value => 0, is_nullable => 1 },
79
  "marc21",
79
  "marc21",
Lines 97-104 __PACKAGE__->add_columns( Link Here
97
__PACKAGE__->set_primary_key("id");
97
__PACKAGE__->set_primary_key("id");
98
98
99
99
100
# Created by DBIx::Class::Schema::Loader v0.07040 @ 2014-06-06 16:20:16
100
# Created by DBIx::Class::Schema::Loader v0.07040 @ 2014-07-01 15:12:50
101
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:uGRmWU0rshP6awyLMQYJeQ
101
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:D9WpVp24RV/MGHktgXzdkQ
102
102
103
103
104
# You can replace this text with custom code or comments, and it will be preserved on regeneration
104
# You can replace this text with custom code or comments, and it will be preserved on regeneration
(-)a/Koha/SearchEngine/QueryBuilder.pm (-8 / +35 lines)
Lines 2-8 package Koha::SearchEngine::QueryBuilder; Link Here
2
2
3
# This file is part of Koha.
3
# This file is part of Koha.
4
#
4
#
5
# Copyright 2012 BibLibre
5
# Copyright 2014 Catalyst IT
6
#
6
#
7
# Koha is free software; you can redistribute it and/or modify it
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
8
# under the terms of the GNU General Public License as published by
Lines 17-29 package Koha::SearchEngine::QueryBuilder; Link Here
17
# You should have received a copy of the GNU General Public License
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
19
20
use Moose;
20
# This is a shim that gives you the appropriate query builder for your
21
# system preference.
21
22
22
use Moose::Util qw( apply_all_roles );
23
=head1 NAME
24
25
Koha::SearchEngine::QueryBuilder - instantiates the query builder that
26
corresponds to the C<SearchEngine> system preference
27
28
=head1 DESCRIPTION
29
30
This allows you to be agnostic about what the search engine configuration is
31
and just get whatever querybuilder you need.
32
33
=head1 SYNOPSIS
34
35
    use Koha::SearchEngine::QueryBuilder;
36
    my $qb = Koha::SearchEngine::QueryBuilder->new();
37
38
=head1 METHODS
39
40
=head2 new
41
42
Creates a new C<QueryBuilder> of whatever the relevant type is.
43
44
=cut
45
use C4::Context;
46
use Modern::Perl;
47
48
sub new {
49
    my $engine = C4::Context->preference("SearchEngine");
50
    my $file = "Koha/SearchEngine/${engine}/QueryBuilder.pm";
51
    my $class = "Koha::SearchEngine::${engine}::QueryBuilder";
52
    require $file;
53
    return $class->new(@_);
54
}
23
55
24
sub BUILD {
25
    my $self = shift;
26
    my $syspref = C4::Context->preference("SearchEngine");
27
    apply_all_roles( $self, "Koha::SearchEngine::${syspref}::QueryBuilder" );
28
};
29
1;
56
1;
(-)a/installer/data/mysql/elasticsearch_mapping.sql (-136 / +180 lines)
Lines 1-6 Link Here
1
DROP TABLE IF EXISTS elasticsearch_mapping;
1
DROP TABLE IF EXISTS elasticsearch_mapping;
2
CREATE TABLE `elasticsearch_mapping` (
2
CREATE TABLE `elasticsearch_mapping` (
3
  `id` int(11) NOT NULL AUTO_INCREMENT,
3
  `id` int(11) NOT NULL AUTO_INCREMENT,
4
  `indexname` varchar(255) NOT NULL,
4
  `mapping` varchar(255) DEFAULT NULL,
5
  `mapping` varchar(255) DEFAULT NULL,
5
  `type` varchar(255) NOT NULL,
6
  `type` varchar(255) NOT NULL,
6
  `facet` boolean DEFAULT FALSE,
7
  `facet` boolean DEFAULT FALSE,
Lines 8-148 CREATE TABLE `elasticsearch_mapping` ( Link Here
8
  `unimarc` varchar(255) DEFAULT NULL,
9
  `unimarc` varchar(255) DEFAULT NULL,
9
  `normarc` varchar(255) DEFAULT NULL,
10
  `normarc` varchar(255) DEFAULT NULL,
10
  PRIMARY KEY (`id`)
11
  PRIMARY KEY (`id`)
11
) ENGINE=InnoDB AUTO_INCREMENT=126 DEFAULT CHARSET=utf8;
12
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
12
13
14
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','llength',FALSE,'','leader_/1-5',NULL,'leader_/1-5');
15
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','rtype',FALSE,'','leader_/6',NULL,'leader_/6');
16
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','bib-level',FALSE,'','leader_/7',NULL,'leader_/7');
17
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','control-number',FALSE,'','001',NULL,'001');
18
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','local-number',FALSE,'',NULL,'001',NULL);
19
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','date-time-last-modified',FALSE,'','005','099d',NULL);
20
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','microform-generation',FALSE,'','007_/11',NULL,'007_/11');
21
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','material-type',FALSE,'','007','200b','007');
22
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','ff7-00',FALSE,'','007_/1',NULL,'007_/1');
23
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','ff7-01',FALSE,'','007_/2',NULL,'007_/2');
24
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','ff7-02',FALSE,'','007_/3',NULL,'007_/3');
25
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','ff7-01-02',FALSE,'','007_/1-2',NULL,'007_/1-2');
26
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','date-entered-on-file',FALSE,'','008_/1-5','099c','008_/1-5');
27
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','pubdate',FALSE,'','008_/7-10','100a_/9-12','008_/7-10');
28
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','pl',FALSE,'','008_/15-17','210a','008_/15-17');
29
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','ta',FALSE,'','008_/22','100a_/17','008_/22');
30
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','ff8-23',FALSE,'','008_/23',NULL,'008_/23');
31
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','ff8-29',FALSE,'','008_/29','105a_/8','008_/29');
32
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','lf',FALSE,'','008_/33','105a_/11','008_/33');
33
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','bio',FALSE,'','008_/34','105a_/12','008_/34');
34
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','ln',FALSE,'','008_/35-37','101a','008_/35-37');
35
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','ctype',FALSE,'','008_/24-27','105a_/4-7','008_/24-27');
36
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','record-source',FALSE,'','008_/39','995c','008_/39');
37
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','lc-cardnumber',FALSE,'','010','995j','010');
38
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','lc-cardnumber',FALSE,'','011',NULL,NULL);
39
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','identifier-standard',FALSE,'','010',NULL,'010');
40
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','identifier-standard',FALSE,'','011',NULL,NULL);
41
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','bnb-card-number',FALSE,'','015',NULL,'015');
42
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','bgf-number',FALSE,'','015',NULL,'015');
43
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','number-db',FALSE,'','015',NULL,'015');
44
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','number-natl-biblio',FALSE,'','015',NULL,'015');
45
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','identifier-standard',FALSE,'','015',NULL,'015');
46
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','number-legal-deposit',FALSE,'','017',NULL,NULL);
47
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','identifier-standard',FALSE,'','017',NULL,NULL);
48
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','identifier-standard',FALSE,'','018',NULL,NULL);
49
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','identifier-standard',FALSE,'','020a','010az','020a');
50
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','isbn',FALSE,'','020a','010az','020a');
51
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','identifier-standard',FALSE,'','022a','011ayz','022a');
52
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','issn',FALSE,'','022a','011ayz','022a');
53
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','author',TRUE,'string','100a','200f','100a');
54
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','author',TRUE,'string','110a','200g','110a');
55
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','author',TRUE,'string','111a',NULL,'111a');
56
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','author',TRUE,'string','700a','700a','700a');
57
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','author',FALSE,'string','245c','701','245c');
58
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string','245a','200a','245a');
59
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string','246','200c','246');
60
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string','247','200d','247');
61
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string','490','200e','490a');
62
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string','505t','200h',NULL);
63
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string','711t','200i','711t');
64
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string','700t','205','700t');
65
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string','710t','304a','710t');
66
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string','730','327a','730');
67
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string','740','327b','740');
68
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string','780','327c','780');
69
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string','785','327d','785');
70
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string','130','327e','130');
71
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string','210','327f','210');
72
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string','211','327g',NULL);
73
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string','212','327h',NULL);
74
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string','214','327i',NULL);
75
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string','222','328t','222');
76
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string','240','410t','240');
77
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'411t',NULL);
78
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'412t',NULL);
79
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'413t',NULL);
80
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'421t',NULL);
81
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'422t',NULL);
82
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'423t',NULL);
83
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'424t',NULL);
84
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'425t',NULL);
85
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'430t',NULL);
86
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'431t',NULL);
87
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'432t',NULL);
88
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'433t',NULL);
89
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'434t',NULL);
90
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'435t',NULL);
91
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'436t',NULL);
92
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'437t',NULL);
93
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'440t',NULL);
94
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'441t',NULL);
95
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'442t',NULL);
96
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'443t',NULL);
97
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'444t',NULL);
98
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'445t',NULL);
99
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'446t',NULL);
100
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'447t',NULL);
101
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'448t',NULL);
102
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'451t',NULL);
103
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'452t',NULL);
104
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'453t',NULL);
105
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'454t',NULL);
106
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'455t',NULL);
107
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'456t',NULL);
108
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'461t',NULL);
109
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'462t',NULL);
110
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'463t',NULL);
111
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'464t',NULL);
112
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'470t',NULL);
113
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'481t',NULL);
114
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'482t',NULL);
115
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','title',FALSE,'string',NULL,'488t',NULL);
116
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','subject',TRUE,'string','600a','600a','600a');
117
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','subject',TRUE,'string','600t','600','600t');
118
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','subject',TRUE,'string','610a','601','610a');
119
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','subject',TRUE,'string','610t','602','610t');
120
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','subject',TRUE,'string','611','604','611');
121
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','subject',TRUE,'string','630n','605','630n');
122
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','subject',TRUE,'string','630r','606','630r');
123
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','subject',TRUE,'string','650a','607','650a');
124
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','subject',TRUE,'string','650b',NULL,'650b');
125
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','subject',TRUE,'string','650c',NULL,'650c');
126
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','subject',TRUE,'string','650d',NULL,'650d');
127
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','subject',TRUE,'string','650v',NULL,'650v');
128
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','subject',TRUE,'string','650x',NULL,'650x');
129
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','subject',TRUE,'string','650y',NULL,'650y');
130
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','subject',TRUE,'string','650z',NULL,'650z');
131
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','subject',TRUE,'string','651','608','651');
132
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','subject',TRUE,'string','653a','610','653');
133
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','local-classification',FALSE,'','952o','995k','952o');
134
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','local-classification',FALSE,'',NULL,'686',NULL);
135
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','local-number',FALSE,'','999c','001','999c');
136
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','local-number',FALSE,'',NULL,'0909',NULL);
137
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','itype',TRUE,'string','942c','200b','942c');
138
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','itype',TRUE,'string','952y','995r','952y');
139
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','acqdate',FALSE,'date','952d','9955','952y');
140
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','place',TRUE,'string','260a','210a','260a');
141
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','publisher',TRUE,'string','260b','210c','260b');
142
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','copydate',TRUE,'date','260c',NULL,'260c'); -- No copydate for unimarc? Seems strange.
143
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','homebranch',TRUE,'string','952a','995b','952a');
144
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','holdingbranch',TRUE,'string','952b','995c','952b');
145
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','onloan',FALSE,'boolean','952q','995n','952q');
146
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','itemnumber',FALSE,'number','9529','9959','9529');
147
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('biblios','issues',FALSE,'sum','952l',NULL,'952l'); -- Apparently not tracked in unimarc
13
148
14
149
--- Authorities: incomplete 
15
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('llength',FALSE,'','leader_/1-5',NULL,'leader_/1-5');
150
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Local-Number',FALSE,'string','001',NULL,'001');
16
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('rtype',FALSE,'','leader_/6',NULL,'leader_/6');
151
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','authtype',FALSE,'','942a',NULL,'942a');
17
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('bib-level',FALSE,'','leader_/7',NULL,'leader_/7');
152
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Kind-of-record',FALSE,'','008_/9',NULL,'008_/9');
18
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('control-number',FALSE,'','001',NULL,'001');
153
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Descriptive-cataloging-rules',FALSE,'','008_/10',NULL,'008_/10');
19
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('local-number',FALSE,'',NULL,'001',NULL);
154
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Subject-heading-thesaurus',FALSE,'','008_/11',NULL,'008_/11');
20
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('date-time-last-modified',FALSE,'','005','099d',NULL);
155
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Heading-use-main-or-added-entry',FALSE,'','008_/14',NULL,'008_/14');
21
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('microform-generation',FALSE,'','007_/11',NULL,'007_/11');
156
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Heading-use-subject-added-entry',FALSE,'','008_/15',NULL,'008_/15');
22
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('material-type',FALSE,'','007','200b','007');
157
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Heading-use-series-added-entry',FALSE,'','008_/16',NULL,'008_/16');
23
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('ff7-00',FALSE,'','007_/1',NULL,'007_/1');
158
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','LC-card-number',FALSE,'','010az',NULL,'010az');
24
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('ff7-01',FALSE,'','007_/2',NULL,'007_/2');
159
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Record-source',FALSE,'','040acd',NULL,'040acd');
25
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('ff7-02',FALSE,'','007_/3',NULL,'007_/3');
160
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Personal-name',FALSE,'','100abcdefghjklmnopqrstvxyz',NULL,'100abcdefghjklmnopqrstvxyz');
26
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('ff7-01-02',FALSE,'','007_/1-2',NULL,'007_/1-2');
161
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Personal-name-heading',FALSE,'','100abcdefghjklmnopqrstvxyz',NULL,'100abcdefghjklmnopqrstvxyz');
27
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('date-entered-on-file',FALSE,'','008_/1-5','099c','008_/1-5');
162
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Heading',FALSE,'','100abcdefghjklmnopqrstvxyz',NULL,'100abcdefghjklmnopqrstvxyz');
28
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('pubdate',FALSE,'','008_/7-10','100a_/9-12','008_/7-10');
163
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Heading-main',FALSE,'','100a',NULL,'100a');
29
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('pl',FALSE,'','008_/15-17','210a','008_/15-17');
164
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Match',FALSE,'','100abcdefghjklmnopqrstvxyz',NULL,'100abcdefghjklmnopqrstvxyz');
30
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('ta',FALSE,'','008_/22','100a_/17','008_/22');
165
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Match-heading',FALSE,'','100abcdefghjklmnopqrstvxyz',NULL,'100abcdefghjklmnopqrstvxyz');
31
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('ff8-23',FALSE,'','008_/23',NULL,'008_/23');
166
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Personal-name-see-from',FALSE,'','400abcdefghjklmnopqrstvxyz',NULL,'400abcdefghjklmnopqrstvxyz');
32
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('ff8-29',FALSE,'','008_/29','105a_/8','008_/29');
167
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','See-from',FALSE,'','400abcdefghjklmnopqrstvxyz',NULL,'400abcdefghjklmnopqrstvxyz');
33
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('lf',FALSE,'','008_/33','105a_/11','008_/33');
168
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Match',FALSE,'','400abcdefghjklmnopqrstvxyz',NULL,'400abcdefghjklmnopqrstvxyz');
34
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('bio',FALSE,'','008_/34','105a_/12','008_/34');
169
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Match-heading-see-from',FALSE,'','400abcdefghjklmnopqrstvxyz',NULL,'400abcdefghjklmnopqrstvxyz');
35
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('ln',FALSE,'','008_/35-37','101a','008_/35-37');
170
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Personal-name-see-also-from',FALSE,'','500abcdefghjklmnopqrstvxyz',NULL,'500abcdefghjklmnopqrstvxyz');
36
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('ctype',FALSE,'','008_/24-27','105a_/4-7','008_/24-27');
171
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','See-also-from',FALSE,'','500abcdefghjklmnopqrstvxyz',NULL,'500abcdefghjklmnopqrstvxyz');
37
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('record-source',FALSE,'','008_/39','995c','008_/39');
172
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Match',FALSE,'','500abcdefghjklmnopqrstvxyz',NULL,'500abcdefghjklmnopqrstvxyz');
38
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('lc-cardnumber',FALSE,'','010','995j','010');
173
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Corporate-name-see-from',FALSE,'','410abcdefghklmnoprstvxyz',NULL,'410abcdefghklmnoprstvxyz');
39
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('lc-cardnumber',FALSE,'','011',NULL,NULL);
174
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','See-from',FALSE,'','410abcdefghklmnoprstvxyz',NULL,'410abcdefghklmnoprstvxyz');
40
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('identifier-standard',FALSE,'','010',NULL,'010');
175
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Match',FALSE,'','410abcdefghklmnoprstvxyz',NULL,'410abcdefghklmnoprstvxyz');
41
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('identifier-standard',FALSE,'','011',NULL,NULL);
176
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Match-heading-see-from',FALSE,'','410abcdefghklmnoprstvxyz',NULL,'410abcdefghklmnoprstvxyz');
42
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('bnb-card-number',FALSE,'','015',NULL,'015');
177
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Corporate-name-see-also-from',FALSE,'','510abcdefghklmnoprstvxyz',NULL,'510abcdefghklmnoprstvxyz');
43
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('bgf-number',FALSE,'','015',NULL,'015');
178
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','See-also-from',FALSE,'','510abcdefghklmnoprstvxyz',NULL,'510abcdefghklmnoprstvxyz');
44
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('number-db',FALSE,'','015',NULL,'015');
179
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Match',FALSE,'','510abcdefghklmnoprstvxyz',NULL,'510abcdefghklmnoprstvxyz');
45
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('number-natl-biblio',FALSE,'','015',NULL,'015');
180
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Meeting-name',FALSE,'','111acdefghjklnpqstvxyz',NULL,'111acdefghjklnpqstvxyz');
46
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('identifier-standard',FALSE,'','015',NULL,'015');
181
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Meeting-name-heading',FALSE,'','111acdefghjklnpqstvxyz',NULL,'111acdefghjklnpqstvxyz');
47
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('number-legal-deposit',FALSE,'','017',NULL,NULL);
182
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Heading',FALSE,'','111acdefghjklnpqstvxyz',NULL,'111acdefghjklnpqstvxyz');
48
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('identifier-standard',FALSE,'','017',NULL,NULL);
183
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Heading-Main',FALSE,'','111a',NULL,'111a');
49
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('identifier-standard',FALSE,'','018',NULL,NULL);
184
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Match',FALSE,'','111acdefghjklnpqstvxyz',NULL,'111acdefghjklnpqstvxyz');
50
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('identifier-standard',FALSE,'','020a','010az','020a');
185
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Match-heading',FALSE,'','111acdefghjklnpqstvxyz',NULL,'111acdefghjklnpqstvxyz');
51
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('isbn',FALSE,'','020a','010az','020a');
186
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Meeting-name-see-from',FALSE,'','411acdefghjklnpqstvxyz',NULL,'411acdefghjklnpqstvxyz');
52
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('identifier-standard',FALSE,'','022a','011ayz','022a');
187
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','See-from',FALSE,'','411acdefghjklnpqstvxyz',NULL,'411acdefghjklnpqstvxyz');
53
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('issn',FALSE,'','022a','011ayz','022a');
188
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Match',FALSE,'','411acdefghjklnpqstvxyz',NULL,'411acdefghjklnpqstvxyz');
54
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('author',TRUE,'string','100a','200f','100a');
189
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Match-heading-see-from',FALSE,'','411acdefghjklnpqstvxyz',NULL,'411acdefghjklnpqstvxyz');
55
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('author',TRUE,'string','110a','200g','110a');
190
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Meeting-name-see-also-from',FALSE,'','511acdefghjklnpqstvxyz',NULL,'511acdefghjklnpqstvxyz');
56
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('author',TRUE,'string','111a',NULL,'111a');
191
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','See-also-from',FALSE,'','511acdefghjklnpqstvxyz',NULL,'511acdefghjklnpqstvxyz');
57
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('author',TRUE,'string','700a','700a','700a');
192
INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('authorities','Match',FALSE,'','511acdefghjklnpqstvxyz',NULL,'511acdefghjklnpqstvxyz');
58
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('author',FALSE,'string','245c','701','245c');
59
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string','245a','200a','245a');
60
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string','246','200c','246');
61
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string','247','200d','247');
62
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string','490','200e','490a');
63
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string','505t','200h',NULL);
64
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string','711t','200i','711t');
65
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string','700t','205','700t');
66
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string','710t','304a','710t');
67
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string','730','327a','730');
68
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string','740','327b','740');
69
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string','780','327c','780');
70
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string','785','327d','785');
71
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string','130','327e','130');
72
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string','210','327f','210');
73
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string','211','327g',NULL);
74
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string','212','327h',NULL);
75
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string','214','327i',NULL);
76
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string','222','328t','222');
77
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string','240','410t','240');
78
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'411t',NULL);
79
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'412t',NULL);
80
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'413t',NULL);
81
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'421t',NULL);
82
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'422t',NULL);
83
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'423t',NULL);
84
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'424t',NULL);
85
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'425t',NULL);
86
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'430t',NULL);
87
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'431t',NULL);
88
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'432t',NULL);
89
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'433t',NULL);
90
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'434t',NULL);
91
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'435t',NULL);
92
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'436t',NULL);
93
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'437t',NULL);
94
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'440t',NULL);
95
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'441t',NULL);
96
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'442t',NULL);
97
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'443t',NULL);
98
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'444t',NULL);
99
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'445t',NULL);
100
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'446t',NULL);
101
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'447t',NULL);
102
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'448t',NULL);
103
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'451t',NULL);
104
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'452t',NULL);
105
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'453t',NULL);
106
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'454t',NULL);
107
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'455t',NULL);
108
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'456t',NULL);
109
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'461t',NULL);
110
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'462t',NULL);
111
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'463t',NULL);
112
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'464t',NULL);
113
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'470t',NULL);
114
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'481t',NULL);
115
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'482t',NULL);
116
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('title',FALSE,'string',NULL,'488t',NULL);
117
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('subject',TRUE,'string','600a','600a','600a');
118
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('subject',TRUE,'string','600t','600','600t');
119
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('subject',TRUE,'string','610a','601','610a');
120
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('subject',TRUE,'string','610t','602','610t');
121
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('subject',TRUE,'string','611','604','611');
122
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('subject',TRUE,'string','630n','605','630n');
123
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('subject',TRUE,'string','630r','606','630r');
124
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('subject',TRUE,'string','650a','607','650a');
125
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('subject',TRUE,'string','650b',NULL,'650b');
126
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('subject',TRUE,'string','650c',NULL,'650c');
127
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('subject',TRUE,'string','650d',NULL,'650d');
128
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('subject',TRUE,'string','650v',NULL,'650v');
129
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('subject',TRUE,'string','650x',NULL,'650x');
130
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('subject',TRUE,'string','650y',NULL,'650y');
131
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('subject',TRUE,'string','650z',NULL,'650z');
132
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('subject',TRUE,'string','651','608','651');
133
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('subject',TRUE,'string','653a','610','653');
134
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('local-classification',FALSE,'','952o','995k','952o');
135
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('local-classification',FALSE,'',NULL,'686',NULL);
136
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('local-number',FALSE,'','999c','001','999c');
137
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('local-number',FALSE,'',NULL,'0909',NULL);
138
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('itype',TRUE,'string','942c','200b','942c');
139
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('itype',TRUE,'string','952y','995r','952y');
140
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('acqdate',FALSE,'date','952d','9955','952y');
141
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('place',TRUE,'string','260a','210a','260a');
142
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('publisher',TRUE,'string','260b','210c','260b');
143
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('copydate',TRUE,'date','260c',NULL,'260c'); -- No copydate for unimarc? Seems strange.
144
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('homebranch',TRUE,'string','952a','995b','952a');
145
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('holdingbranch',TRUE,'string','952b','995c','952b');
146
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('onloan',FALSE,'boolean','952q','995n','952q');
147
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('itemnumber',FALSE,'number','9529','9959','9529');
148
INSERT INTO `elasticsearch_mapping` (`mapping`, `facet`, `type`, `marc21`, `unimarc`, `normarc`) VALUES ('issues',FALSE,'sum','952l',NULL,'952l'); -- Apparently not tracked in unimarc
(-)a/misc/search_tools/rebuild_elastic_search.pl (-36 / +86 lines)
Lines 46-55 Higher should be faster, but will cause more RAM usage. Default is 100. Link Here
46
46
47
Delete the index and recreate it before indexing.
47
Delete the index and recreate it before indexing.
48
48
49
=item B<-b|--biblionumber>
49
=item B<-a|--authorities>
50
51
Index the authorities only. Combining this with B<-b> is the same as
52
specifying neither and so both get indexed.
53
54
=item B<-b|--biblios>
55
56
Index the biblios only. Combining this with B<-a> is the same as
57
specifying neither and so both get indexed.
58
59
=item B<-bn|--bnumber>
50
60
51
Only index the supplied biblionumber, mostly for testing purposes. May be
61
Only index the supplied biblionumber, mostly for testing purposes. May be
52
repeated.
62
repeated. This also applies to authorities via authid, so if you're using it,
63
you probably only want to do one or the other at a time.
53
64
54
=item B<-v|--verbose>
65
=item B<-v|--verbose>
55
66
Lines 68-73 Full documentation. Link Here
68
79
69
use autodie;
80
use autodie;
70
use Getopt::Long;
81
use Getopt::Long;
82
use Koha::Authority;
71
use Koha::Biblio;
83
use Koha::Biblio;
72
use Koha::ElasticSearch::Indexer;
84
use Koha::ElasticSearch::Indexer;
73
use MARC::Field;
85
use MARC::Field;
Lines 80-139 use Data::Dumper; # TODO remove Link Here
80
my $verbose = 0;
92
my $verbose = 0;
81
my $commit = 100;
93
my $commit = 100;
82
my ($delete, $help, $man);
94
my ($delete, $help, $man);
95
my ($index_biblios, $index_authorities);
83
my (@biblionumbers);
96
my (@biblionumbers);
84
97
85
GetOptions(
98
GetOptions(
86
    'c|commit=i'       => \$commit,
99
    'c|commit=i'       => \$commit,
87
    'd|delete'         => \$delete,
100
    'd|delete'         => \$delete,
88
    'b|biblionumber=i' => \@biblionumbers,
101
    'a|authorities' => \$index_authorities,
102
    'b|biblios' => \$index_biblios,
103
    'bn|bnumber=i' => \@biblionumbers,
89
    'v|verbose!'       => \$verbose,
104
    'v|verbose!'       => \$verbose,
90
    'h|help'           => \$help,
105
    'h|help'           => \$help,
91
    'man'              => \$man,
106
    'man'              => \$man,
92
);
107
);
93
108
109
# Default is to do both
110
unless ($index_authorities || $index_biblios) {
111
    $index_authorities = $index_biblios = 1;
112
}
113
94
pod2usage(1) if $help;
114
pod2usage(1) if $help;
95
pod2usage( -exitstatus => 0, -verbose => 2 ) if $man;
115
pod2usage( -exitstatus => 0, -verbose => 2 ) if $man;
96
116
97
my $next;
117
my $next;
98
if (@biblionumbers) {
118
if ($index_biblios) {
99
    $next = sub {
119
    _log(1, "Indexing biblios\n");
100
        my $r = shift @biblionumbers;
120
    if (@biblionumbers) {
101
        return () unless defined $r;
121
        $next = sub {
102
        return ($r, Koha::Biblio->get_marc_biblio($r, item_data => 1));
122
            my $r = shift @biblionumbers;
103
    };
123
            return () unless defined $r;
104
} else {
124
            return ($r, Koha::Biblio->get_marc_biblio($r, item_data => 1));
105
    my $records = Koha::Biblio->get_all_biblios_iterator();
125
        };
106
    $next = sub {
126
    } else {
107
        $records->next();
127
        my $records = Koha::Biblio->get_all_biblios_iterator();
128
        $next = sub {
129
            $records->next();
130
        }
108
    }
131
    }
132
    do_reindex($next, $Koha::ElasticSearch::BIBLIOS_INDEX);
109
}
133
}
110
my $indexer = Koha::ElasticSearch::Indexer->new({index => 'biblios' });
134
if ($index_authorities) {
111
if ($delete) {
135
    _log(1, "Indexing authorities\n");
112
    # We know it's safe to not recreate the indexer because update_index
136
    if (@biblionumbers) {
113
    # hasn't been called yet.
137
        $next = sub {
114
    $indexer->delete_index();
138
            my $r = shift @biblionumbers;
139
            return () unless defined $r;
140
            my $a = Koha::Authority->get_from_authid($r);
141
            return ($r, $a->record);
142
        };
143
    } else {
144
        my $records = Koha::Authority->get_all_authorities_iterator();
145
        $next = sub {
146
            $records->next();
147
        }
148
    }
149
    do_reindex($next, $Koha::ElasticSearch::AUTHORITIES_INDEX);
115
}
150
}
116
151
117
my $count = 0;
152
sub do_reindex {
118
my $commit_count = $commit;
153
    my ( $next, $index_name ) = @_;
119
my (@bibnums_buffer, @commit_buffer);
154
120
while (scalar(my ($bibnum, $rec) = $next->())) {
155
    my $indexer = Koha::ElasticSearch::Indexer->new( { index => $index_name } );
121
    _log(1,"$bibnum\n");
156
    if ($delete) {
122
    $count++;
157
123
158
        # We know it's safe to not recreate the indexer because update_index
124
    push @bibnums_buffer, $bibnum;
159
        # hasn't been called yet.
125
    push @commit_buffer, $rec;
160
        $indexer->delete_index();
126
    if (!(--$commit_count)) {
127
        _log(2, "Committing...\n");
128
        $indexer->update_index(\@bibnums_buffer, \@commit_buffer);
129
        $commit_count = $commit;
130
        @bibnums_buffer = ();
131
        @commit_buffer = ();
132
    }
161
    }
162
163
    my $count        = 0;
164
    my $commit_count = $commit;
165
    my ( @id_buffer, @commit_buffer );
166
    while ( my $record = $next->() ) {
167
        my $id     = $record->idnumber;
168
        my $record = $record->record;
169
        _log( 1, "$id\n" );
170
        $count++;
171
172
        push @id_buffer,     $id;
173
        push @commit_buffer, $record;
174
        if ( !( --$commit_count ) ) {
175
            _log( 2, "Committing...\n" );
176
            $indexer->update_index( \@id_buffer, \@commit_buffer );
177
            $commit_count  = $commit;
178
            @id_buffer     = ();
179
            @commit_buffer = ();
180
        }
181
    }
182
183
    # There are probably uncommitted records
184
    $indexer->update_index( \@id_buffer, \@commit_buffer );
185
    _log( 1, "$count records indexed.\n" );
133
}
186
}
134
# There are probably uncommitted records
135
$indexer->update_index(\@bibnums_buffer, \@commit_buffer);
136
_log(1, "$count records indexed.\n");
137
187
138
# Output progress information.
188
# Output progress information.
139
#
189
#
(-)a/opac/opac-search.pl (-8 / +2 lines)
Lines 32-45 use List::MoreUtils q/any/; Link Here
32
32
33
use Data::Dumper; # TODO remove
33
use Data::Dumper; # TODO remove
34
34
35
use Koha::SearchEngine::Elasticsearch::QueryBuilder;
36
use Koha::ElasticSearch::Search;
35
use Koha::ElasticSearch::Search;
37
use Koha::SearchEngine::Zebra::QueryBuilder;
36
use Koha::SearchEngine::QueryBuilder;
38
use Koha::SearchEngine::Zebra::Search;
37
use Koha::SearchEngine::Zebra::Search;
39
38
40
my $searchengine = C4::Context->preference("SearchEngine");
39
my $searchengine = C4::Context->preference("SearchEngine");
41
my ($builder, $searcher);
40
my ($builder, $searcher);
42
#$searchengine = 'Zebra'; # XXX
41
#$searchengine = 'Zebra'; # XXX
42
$builder = Koha::SearchEngine::QueryBuilder->new();
43
for ( $searchengine ) {
43
for ( $searchengine ) {
44
    when ( /^Solr$/ ) {
44
    when ( /^Solr$/ ) {
45
        warn "We use Solr";
45
        warn "We use Solr";
Lines 47-60 for ( $searchengine ) { Link Here
47
        exit;
47
        exit;
48
    }
48
    }
49
    when ( /^Zebra$/ ) {
49
    when ( /^Zebra$/ ) {
50
        $builder=Koha::SearchEngine::Zebra::QueryBuilder->new();
51
        $searcher=Koha::SearchEngine::Zebra::Search->new();
50
        $searcher=Koha::SearchEngine::Zebra::Search->new();
52
    }
51
    }
53
    when (/^Elasticsearch$/) {
52
    when (/^Elasticsearch$/) {
54
        # Should use the base QueryBuilder, but I don't have it wired up
55
        # for moose yet.
56
        $builder=Koha::SearchEngine::Elasticsearch::QueryBuilder->new();
57
#        $builder=Koha::SearchEngine::Zebra::QueryBuilder->new();
58
        $searcher=Koha::ElasticSearch::Search->new({index => 'biblios'});
53
        $searcher=Koha::ElasticSearch::Search->new({index => 'biblios'});
59
    }
54
    }
60
}
55
}
61
- 

Return to bug 12478