Skip to content

Commit

Permalink
Merge pull request #69 from ianthe/LIB001-818
Browse files Browse the repository at this point in the history
LIB001-818: Addition of healthcheck controller and suppressing solr conn...
  • Loading branch information
ianthe committed Sep 5, 2014
2 parents 4ab38ee + 29e82fb commit e55b53b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
45 changes: 45 additions & 0 deletions application/controllers/healthcheck.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

require_once('skylight.php');

class HealthCheck extends skylight {

function HealthCheck() {
// Initalise the parent
parent::__construct();
}

public function index() {

$errorMsg = "";

try {
$data = $this->solr_client->simpleSearch('*:*', 1, array(), 'OR', 'score+desc');
}
catch(Exception $e) {
$errorMsg = 'Caught exception: ' . $e->getMessage();
}

// Inject query back into results
$data['query'] = '*:*';
$data['base_search'] = './search/*:*';
$data['event_search'] = './timeline//*:*';
$data['base_parameters'] = '?sort_by=score+desc';
$data['delimiter'] = $this->config->item('skylight_filter_delimiter');
$data['page_title'] = $this->config->item('skylight_page_title_prefix') . ' Health Check';
$data['page_heading'] = 'Health Check';
$data['error_message'] = $errorMsg;

$this->view('header', $data);
$this->view('div_main');
$this->view('healthcheck', $data);
$this->view('div_main_end');
$this->view('div_sidebar');
$this->view('search_facets', $data);
$this->view('div_sidebar_end');
$this->view('footer');

}


}
2 changes: 1 addition & 1 deletion application/libraries/solr/solr_client_dspace_181.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ function simpleSearch($q = '*:*', $offset = 1, $fq = array(), $operator = 'OR',
$url .= '&spellcheck.dictionary=' . $this->dictionary;
//print_r('simple search '. $url);

$solr_xml = file_get_contents($url);
$solr_xml = @file_get_contents($url);
$search_xml = @new SimpleXMLElement($solr_xml);

$docs = array();
Expand Down
2 changes: 1 addition & 1 deletion application/libraries/solr/solr_client_dspace_exams.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ function simpleSearch($q = '*:*', $offset = 1, $fq = array(), $operator = 'OR',
$url .= '&spellcheck.dictionary=' . $this->dictionary;

// Call Solr!
$solr_xml = file_get_contents($url);
$solr_xml = @file_get_contents($url);
$search_xml = @new SimpleXMLElement($solr_xml);

$docs = array();
Expand Down

0 comments on commit e55b53b

Please sign in to comment.