Lines 12274-12282
if ( $column_has_been_used ) {
Link Here
|
12274 |
|
12274 |
|
12275 |
$DBversion = "3.23.00.050"; |
12275 |
$DBversion = "3.23.00.050"; |
12276 |
if ( CheckVersion($DBversion) ) { |
12276 |
if ( CheckVersion($DBversion) ) { |
12277 |
use YAML::Syck; |
|
|
12278 |
use Koha::SearchMarcMaps; |
12277 |
use Koha::SearchMarcMaps; |
12279 |
use Koha::SearchFields; |
12278 |
use Koha::SearchFields; |
|
|
12279 |
use Koha::ElasticSearch; |
12280 |
|
12280 |
|
12281 |
$dbh->do(q|INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) |
12281 |
$dbh->do(q|INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) |
12282 |
VALUES('SearchEngine','Zebra','Choose Search Engine','','Choice')|); |
12282 |
VALUES('SearchEngine','Zebra','Choose Search Engine','','Choice')|); |
Lines 12338-12358
$dbh->do(q|
Link Here
|
12338 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci |
12338 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci |
12339 |
|); |
12339 |
|); |
12340 |
|
12340 |
|
12341 |
my $mappings_yaml = C4::Context->config('intranetdir') . '/admin/searchengine/elasticsearch/mappings.yaml'; |
12341 |
# Insert default mappings |
12342 |
my $indexes = LoadFile( $mappings_yaml ); |
12342 |
Koha::ElasticSearch->reset_elasticsearch_mappings; |
12343 |
|
|
|
12344 |
while ( my ( $index_name, $fields ) = each %$indexes ) { |
12345 |
while ( my ( $field_name, $data ) = each %$fields ) { |
12346 |
my $field_type = $data->{type}; |
12347 |
my $field_label = $data->{label}; |
12348 |
my $mappings = $data->{mappings}; |
12349 |
my $search_field = Koha::SearchFields->find_or_create({ name => $field_name, label => $field_label, type => $field_type }, { key => 'name' }); |
12350 |
for my $mapping ( @$mappings ) { |
12351 |
my $marc_field = Koha::SearchMarcMaps->find_or_create({ index_name => $index_name, marc_type => $mapping->{marc_type}, marc_field => $mapping->{marc_field} }); |
12352 |
$search_field->add_to_search_marc_maps($marc_field, { facet => $mapping->{facet}, suggestible => $mapping->{suggestible}, sort => $mapping->{sort} } ); |
12353 |
} |
12354 |
} |
12355 |
} |
12356 |
|
12343 |
|
12357 |
print "Upgrade to $DBversion done (Bug 12478 - Elasticsearch support for Koha)\n"; |
12344 |
print "Upgrade to $DBversion done (Bug 12478 - Elasticsearch support for Koha)\n"; |
12358 |
SetVersion($DBversion); |
12345 |
SetVersion($DBversion); |