From 451003ab509641574e537bc96c5bb5797470f044 Mon Sep 17 00:00:00 2001 From: Olli-Antti Kivilahti Date: Thu, 5 Jan 2017 14:13:48 +0200 Subject: [PATCH] Bug 17851 - Add elasticsearch config to koha-conf.xml Missing installer for debian packages. --- Makefile.PL | 37 ++++++++++++++++++++++++++++++++++ debian/templates/koha-conf-site.xml.in | 7 +++++++ etc/koha-conf.xml | 5 +++++ rewrite-config.PL | 3 +++ 4 files changed, 52 insertions(+) diff --git a/Makefile.PL b/Makefile.PL index ee81834..9c396b5 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -198,6 +198,16 @@ Directory for Zebra's data files. Directory for Zebra's UNIX-domain sockets. +=item ELASTICSEARCH_SERVERS + +Server:port of the Elasticsearch server to use, as a comma separated list: +eg. 192.168.0.100:9200, localhost:9200 + +=item ELASTICSEARCH_INDEX + +Unique index in Elasticsearch, for this Koha-instance +eg. koha-mykoha or just koha + =item MISC_DIR Directory for for miscellaenous scripts, among other @@ -448,6 +458,9 @@ my %config_defaults = ( 'USE_MEMCACHED' => 'no', 'MEMCACHED_SERVERS' => '127.0.0.1:11211', 'MEMCACHED_NAMESPACE' => 'KOHA', + 'USE_ELASTICSEARCH' => 'no', + 'ELASTICSEARCH_SERVERS' => '', + 'ELASTICSEARCH_INDEX' => 'koha', 'FONT_DIR' => '/usr/share/fonts/truetype/ttf-dejavu' ); @@ -479,6 +492,7 @@ my %valid_config_values = ( 'ZEBRA_TOKENIZER' => { chr => 1, icu => 1 }, 'RUN_DATABASE_TESTS' => { 'yes' => 1, 'no' => 1 }, 'USE_MEMCACHED' => { 'yes' => 1, 'no' => 1 }, + 'USE_ELASTICSEARCH' => { 'yes' => 1, 'no' => 1 }, ); # get settings from command-line @@ -1090,6 +1104,29 @@ Memcached namespace?); $config{'MEMCACHED_NAMESPACE'} = _get_value('MEMCACHED_NAMESPACE', $msg, $defaults->{'MEMCACHED_NAMESPACE'}, $valid_values, $install_log_values); } + + $msg = q( +Use Elasticsearch to serve search results? +You will need a Elasticsearch server running.); + $msg .= _add_valid_values_disp('USE_ELASTICSEARCH', $valid_values); + $config{'USE_ELASTICSEARCH'} = _get_value('USE_ELASTICSEARCH', $msg, $defaults->{'USE_ELASTICSEARCH'}, $valid_values, $install_log_values); + if ($config{'USE_ELASTICSEARCH'} eq 'yes'){ + $msg = q( +Define the ELASTICSEARCH_SERVERS with a comma-separated list. Eg +localhost:9200, 192.168.0.100:9200 +); + $msg = q( +Elasticsearch server addresses?); + $config{'ELASTICSEARCH_SERVERS'} = _get_value('ELASTICSEARCH_SERVERS', $msg, $defaults->{'ELASTICSEARCH_SERVERS'}, $valid_values, $install_log_values); + + $msg = q( +What index name to use for this Koha-instance? It must be unique for each Koha +sharing the same Elasticsearch-cluster + +Elasticsearch index?); + $config{'ELASTICSEARCH_INDEX'} = _get_value('ELASTICSEARCH_INDEX', $msg, $defaults->{'ELASTICSEARCH_INDEX'}, $valid_values, $install_log_values); + } + $msg = q( Path to DejaVu fonts?); $config{'FONT_DIR'} = _get_value('FONT_DIR', $msg, $defaults->{'FONT_DIR'}, $valid_values, $install_log_values); diff --git a/debian/templates/koha-conf-site.xml.in b/debian/templates/koha-conf-site.xml.in index 6bfe004..9a9f043 100644 --- a/debian/templates/koha-conf-site.xml.in +++ b/debian/templates/koha-conf-site.xml.in @@ -311,5 +311,12 @@ __END_SRU_PUBLICSERVER__ /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-BoldOblique.ttf + + koha + +--> + diff --git a/etc/koha-conf.xml b/etc/koha-conf.xml index 1ce3c90..44b83b7 100644 --- a/etc/koha-conf.xml +++ b/etc/koha-conf.xml @@ -138,5 +138,10 @@ __PAZPAR2_TOGGLE_XML_POST__ __FONT_DIR__/DejaVuSans-BoldOblique.ttf + + __ELASTICSEARCH_SERVERS__ + __ELASTICSEARCH_INDEX__ + + diff --git a/rewrite-config.PL b/rewrite-config.PL index a66b119..c5f935f 100644 --- a/rewrite-config.PL +++ b/rewrite-config.PL @@ -148,6 +148,9 @@ $prefix = $ENV{'INSTALL_BASE'} || "/usr"; "__USE_MEMCACHED__" => 'no', "__MEMCACHED_SERVERS__" => "", "__MEMCACHED_NAMESPACE__" => "", + "__USE_ELASTICSEARCH__" => 'no', + "__ELASTICSEARCH_SERVERS__" => "", + "__ELASTICSEARCH_INDEX__" => "koha", "__FONT_DIR__" => "/usr/share/fonts/truetype/ttf-dejavu", ); -- 2.7.4