$string['noticeenabled']='The Elasticsearch plugin is currently active. To deactivate it, deselect it in the <a href="%s">site options search settings</a>.';
$string['noticenotactive']='The ElasticSearch Server is unreachable on host: %s and port %s. Please make sure it is running.';
$string['noticenotenabled']='The Elasticsearch plugin is not currently enabled. To activate it, select it in the <a href="%s">site options in the search settings</a>.';
$string['noticepostgresrequired']='The Elasticsearch plugin only works with a PostgreSQL database at this time.';
$string['noticepostgresrequiredtitle']='Feature not available';
IF (oldartefacttype IN '.$artefacttypes_str.') AND NOT EXISTS (SELECT 1 FROM {search_elasticsearch_queue} WHERE itemid = oldid AND type = '.$tablewithoutprefix.') THEN
INSERT INTO {search_elasticsearch_queue} (itemid, type, artefacttype) VALUES (oldid, '.$tablewithoutprefix.', oldartefacttype);
END IF;
ELSE
IF (newartefacttype IN '.$artefacttypes_str.') AND NOT EXISTS (SELECT 1 FROM {search_elasticsearch_queue} WHERE itemid = newid AND type = '.$tablewithoutprefix.') THEN
INSERT INTO {search_elasticsearch_queue} (itemid, type, artefacttype) VALUES (newid, '.$tablewithoutprefix.', newartefacttype);
$sql="CREATE TRIGGER {search_elasticsearch_{$type}_{$operation}}{$triggertime}{$operation} ON {{$type}}
FOR EACH ROW CALL {search_elasticsearch_queue_artefact_trigger}('{$tablename}', '{$operation}', {$oldid}, {$oldartefacttype}, {$newid}, {$newartefacttype})";
execute_sql($sql);
// create 3 triggers on the view_artefact table.
$sql="CREATE TRIGGER {search_elasticsearch_view_artefact_{$operation}}{$triggertime}{$operation} ON {view_artefact}
FOR EACH ROW CALL {search_elasticsearch_queue2_trigger}('{$viewtablename}', '{$operation}', {$oldartefact}, {$newartefact})";
execute_sql($sql);
}
}
}
else{
if(is_postgres()){
$sql="CREATE TRIGGER {search_elasticsearch_{$type}} BEFORE INSERT OR UPDATE OR DELETE ON {{$type}}
FOR EACH ROW EXECUTE PROCEDURE {search_elasticsearch_queue_trigger}()";