Bug 12478 - set up database tables for elasticsearch
authorRobin Sheat <robin@catalyst.net.nz>
Mon, 25 Aug 2014 03:55:50 +0000 (15:55 +1200)
committerTomas Cohen Arazi <tomascohen@theke.io>
Tue, 26 Apr 2016 12:52:56 +0000 (09:52 -0300)
This sets up the database changes needed to run ES. This isn't intended
to be ready for upstreaming, just to make testing easier.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

installer/data/mysql/sysprefs.sql
installer/data/mysql/updatedatabase.pl

index f221919..b8dbe81 100644 (file)
@@ -421,6 +421,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('RoutingSerials','1',NULL,'If ON, serials routing is enabled','YesNo'),
 ('SCOUserCSS','',NULL,'Add CSS to be included in the SCO module in an embedded <style> tag.','free'),
 ('SCOUserJS','',NULL,'Define custom javascript for inclusion in the SCO module','free'),
+('SearchEngine','Zebra','Elasticsearch|Solr|Zebra','Search Engine','Choice'),
 ('SearchMyLibraryFirst','0',NULL,'If ON, OPAC searches return results limited by the user\'s library by default if they are logged in','YesNo'),
 ('SearchWithISBNVariations','0',NULL,'If enabled, search on all variations of the ISBN','YesNo'),
 ('SelfCheckHelpMessage','','70|10','Enter HTML to include under the basic Web-based Self Checkout instructions on the Help page','Textarea'),
index 8877a46..0b844d8 100755 (executable)
@@ -10355,7 +10355,7 @@ if ( CheckVersion($DBversion) ) {
     |);
 
     print "Upgrade to $DBversion done (Bug 8007: Add System Preferences useDischarge, the discharge notice and the new table discharges)\n";
-    SetVersion($DBversion);
+    SetVersion ($DBversion);
 }
 
 $DBversion = "3.19.00.036";
@@ -12256,6 +12256,16 @@ if ( $column_has_been_used ) {
 }
 
 
+$DBversion = "XXX";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    my $installer = C4::Installer->new();
+    my $full_path = C4::Context->config('intranetdir') . "/installer/data/$installer->{dbms}/elasticsearch_mapping.sql";
+    my $error     = $installer->load_sql($full_path);
+    warn $error if $error;
+    print "Upgrade to $DBversion done (Bug 12478 - set up elasticsearch tables)\n";
+    SetVersion($DBversion);
+}
+
 # DEVELOPER PROCESS, search for anything to execute in the db_update directory
 # SEE bug 13068
 # if there is anything in the atomicupdate, read and execute it.