[Koha-bugs] [Bug 12478] Elasticsearch support for Koha
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Thu May 5 02:38:04 CEST 2016
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12478
--- Comment #245 from Srdjan Jankovic <srdjan at catalyst.net.nz> ---
Also, with my version of elastic, I had to do following changes:
diff --git a/Koha/ElasticSearch.pm b/Koha/ElasticSearch.pm
index d56c344..22bc064 100644
--- a/Koha/ElasticSearch.pm
+++ b/Koha/ElasticSearch.pm
@@ -171,11 +171,6 @@ sub get_elasticsearch_mappings {
include_in_all => JSON::false,
type => "string",
},
- '_all.phrase' => {
- search_analyzer => "analyser_phrase",
- index_analyzer => "analyser_phrase",
- type => "string",
- },
}
}
};
@@ -195,15 +190,12 @@ sub get_elasticsearch_mappings {
? 'boolean'
: 'string';
$mappings->{data}{properties}{$name} = {
- search_analyzer => "analyser_standard",
- index_analyzer => "analyser_standard",
+ analyzer => "analyser_standard",
type => $es_type,
fields => {
phrase => {
- search_analyzer => "analyser_phrase",
- index_analyzer => "analyser_phrase",
+ analyzer => "analyser_phrase",
type => "string",
- copy_to => "_all.phrase",
},
raw => {
"type" => "string",
@@ -222,22 +214,19 @@ sub get_elasticsearch_mappings {
if ($suggestible) {
$mappings->{data}{properties}{ $name . '__suggestion' } = {
type => 'completion',
- index_analyzer => 'simple',
- search_analyzer => 'simple',
+ analyzer => 'simple',
};
}
# Sort may be true, false, or undef. Here we care if it's
# anything other than undef.
if (defined $sort) {
$mappings->{data}{properties}{ $name . '__sort' } = {
- search_analyzer => "analyser_phrase",
- index_analyzer => "analyser_phrase",
+ analyzer => "analyser_phrase",
type => "string",
include_in_all => JSON::false,
fields => {
phrase => {
- search_analyzer => "analyser_phrase",
- index_analyzer => "analyser_phrase",
+ analyzer => "analyser_phrase",
type => "string",
},
},
diff --git a/installer/data/mysql/updatedatabase.pl
b/installer/data/mysql/updatedatabase.pl
index 9e6d390..e092704 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -12332,13 +12332,13 @@ my $indexes = LoadFile( $mappings_yaml );
while ( my ( $index_name, $fields ) = each %$indexes ) {
while ( my ( $field_name, $data ) = each %$fields ) {
- my $field_type = $data->{type};
+ my $field_type = $data->{type} || 'string';
my $field_label = $data->{label};
my $mappings = $data->{mappings};
my $search_field = Koha::SearchFields->find_or_create({ name =>
$field_name, label => $field_label, type => $field_type }, { key => 'name' });
for my $mapping ( @$mappings ) {
my $marc_field = Koha::SearchMarcMaps->find_or_create({
index_name => $index_name, marc_type => $mapping->{marc_type}, marc_field =>
$mapping->{marc_field} });
- $search_field->add_to_search_marc_maps($marc_field, { facet =>
$mapping->{facet}, suggestible => $mapping->{suggestible}, sort =>
$mapping->{sort} } );
+ $search_field->add_to_search_marc_maps($marc_field, { facet =>
$mapping->{facet} || 0, suggestible => $mapping->{suggestible} || 0, sort =>
$mapping->{sort} || undef } );
}
}
}
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list