Lines 12265-12273
if ( $column_has_been_used ) {
Link Here
|
12265 |
|
12265 |
|
12266 |
$DBversion = "3.23.00.050"; |
12266 |
$DBversion = "3.23.00.050"; |
12267 |
if ( CheckVersion($DBversion) ) { |
12267 |
if ( CheckVersion($DBversion) ) { |
12268 |
use YAML::Syck; |
|
|
12269 |
use Koha::SearchMarcMaps; |
12268 |
use Koha::SearchMarcMaps; |
12270 |
use Koha::SearchFields; |
12269 |
use Koha::SearchFields; |
|
|
12270 |
use Koha::ElasticSearch; |
12271 |
|
12271 |
|
12272 |
$dbh->do(q|INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) |
12272 |
$dbh->do(q|INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) |
12273 |
VALUES('SearchEngine','Zebra','Choose Search Engine','','Choice')|); |
12273 |
VALUES('SearchEngine','Zebra','Choose Search Engine','','Choice')|); |
Lines 12329-12349
$dbh->do(q|
Link Here
|
12329 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci |
12329 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci |
12330 |
|); |
12330 |
|); |
12331 |
|
12331 |
|
12332 |
my $mappings_yaml = C4::Context->config('intranetdir') . '/admin/searchengine/elasticsearch/mappings.yaml'; |
12332 |
# Insert default mappings |
12333 |
my $indexes = LoadFile( $mappings_yaml ); |
12333 |
Koha::ElasticSearch->reset_elasticsearch_meppings; |
12334 |
|
|
|
12335 |
while ( my ( $index_name, $fields ) = each %$indexes ) { |
12336 |
while ( my ( $field_name, $data ) = each %$fields ) { |
12337 |
my $field_type = $data->{type}; |
12338 |
my $field_label = $data->{label}; |
12339 |
my $mappings = $data->{mappings}; |
12340 |
my $search_field = Koha::SearchFields->find_or_create({ name => $field_name, label => $field_label, type => $field_type }, { key => 'name' }); |
12341 |
for my $mapping ( @$mappings ) { |
12342 |
my $marc_field = Koha::SearchMarcMaps->find_or_create({ index_name => $index_name, marc_type => $mapping->{marc_type}, marc_field => $mapping->{marc_field} }); |
12343 |
$search_field->add_to_search_marc_maps($marc_field, { facet => $mapping->{facet}, suggestible => $mapping->{suggestible}, sort => $mapping->{sort} } ); |
12344 |
} |
12345 |
} |
12346 |
} |
12347 |
|
12334 |
|
12348 |
print "Upgrade to $DBversion done (Bug 12478 - Elasticsearch support for Koha)\n"; |
12335 |
print "Upgrade to $DBversion done (Bug 12478 - Elasticsearch support for Koha)\n"; |
12349 |
SetVersion($DBversion); |
12336 |
SetVersion($DBversion); |