Browse Source

match the d7 versions search results by not escapting brackets

2.x
Paul Pound 2 years ago
parent
commit
629ab184dc
  1. 4
      modules/roblib_search_eds/js/eds_results_article.js
  2. 45
      modules/roblib_search_eds/src/Lib/EBSCOAPI.php

4
modules/roblib_search_eds/js/eds_results_article.js

@ -24,8 +24,8 @@ Drupal.behaviors.roblib_search_eds_articles = {
jQuery.each(data.queries, function (key7, query) { jQuery.each(data.queries, function (key7, query) {
queries.push(query.query); queries.push(query.query);
}) })
var query_str = encodeURI(data.queries[0].query); var query_str = data.queries[0].query;
var href_str = 'https://search.ebscohost.com/login.aspx?direct=true&site=eds-live&scope=site&type=1&custid=uprince&groupid=main&profile=eds&mode=bool&lang=en&bquery='; var href_str = 'https://search.ebscohost.com/login.aspx?direct=true&site=eds-live&scope=site&type=1&custid=uprince&groupid=main&profid=edsapi&mode=bool&lang=en&bquery=';
jQuery.each(data.documents, function (key, val) { jQuery.each(data.documents, function (key, val) {
id = 'roblib-search-eds-article-' + counter; id = 'roblib-search-eds-article-' + counter;
divs[counter++] = id; divs[counter++] = id;

45
modules/roblib_search_eds/src/Lib/EBSCOAPI.php

@ -115,7 +115,7 @@ class EBSCOAPI {
* *
* @access public * @access public
*/ */
public function __construct($config) { public function __construct($config) {
$this->config = $config; $this->config = $config;
} }
@ -128,7 +128,7 @@ class EBSCOAPI {
* *
* @access public * @access public
*/ */
public function authenticationToken(){ public function authenticationToken(){
@ -158,7 +158,7 @@ class EBSCOAPI {
$_SESSION["authenticationTimeout"]= $result['authenticationTimeout']; $_SESSION["authenticationTimeout"]= $result['authenticationTimeout'];
$_SESSION['autocompleteUrl'] = $result['autocompleteUrl']; $_SESSION['autocompleteUrl'] = $result['autocompleteUrl'];
$_SESSION['autocompleteToken'] = $result['autocompleteToken']; $_SESSION['autocompleteToken'] = $result['autocompleteToken'];
$_SESSION["autocompleteTokenTimeOut"]= $result['autocompleteTokenTimeOut']; $_SESSION["autocompleteTokenTimeOut"]= $result['autocompleteTokenTimeOut'];
$_SESSION['autocompleteCustId'] = $result['autocompleteCustId']; $_SESSION['autocompleteCustId'] = $result['autocompleteCustId'];
} }
@ -168,11 +168,11 @@ class EBSCOAPI {
$_SESSION["authenticationTimeout"]= $result['authenticationTimeout']; $_SESSION["authenticationTimeout"]= $result['authenticationTimeout'];
$_SESSION['autocompleteUrl'] = $result['autocompleteUrl']; $_SESSION['autocompleteUrl'] = $result['autocompleteUrl'];
$_SESSION['autocompleteToken'] = $result['autocompleteToken']; $_SESSION['autocompleteToken'] = $result['autocompleteToken'];
$_SESSION["autocompleteTokenTimeOut"]= $result['autocompleteTokenTimeOut']; $_SESSION["autocompleteTokenTimeOut"]= $result['autocompleteTokenTimeOut'];
$_SESSION['autocompleteCustId'] = $result['autocompleteCustId']; $_SESSION['autocompleteCustId'] = $result['autocompleteCustId'];
$result = array( $result = array(
'authenticationToken' => $token, 'authenticationToken' => $token,
@ -459,7 +459,10 @@ class EBSCOAPI {
$type = isset($search['index']) && !empty($search['index']) ? $search['index'] : 'AllFields'; $type = isset($search['index']) && !empty($search['index']) ? $search['index'] : 'AllFields';
// Escape some characters from lookfor term. // Escape some characters from lookfor term.
$term = str_replace(array(',', ':', '(', ')'), array('\,', '\:', '\(', '\)'), $lookfor); //$term = str_replace(array(',', ':', '(', ')'), array('\,', '\:', '\(', '\)'), $lookfor);
// The below version of the above matches the drupal 7 searches but the above may give less but better results
// and be worth testing down the road.
$term = str_replace(array(',', ':'), array('\,', '\:'), $lookfor);
// Replace multiple consecutive empty spaces with one empty space. // Replace multiple consecutive empty spaces with one empty space.
$term = preg_replace("/\s+/", ' ', $term); $term = preg_replace("/\s+/", ' ', $term);
@ -592,7 +595,7 @@ class EBSCOAPI {
// Specifies whether or not to include highlighting in the search results. // Specifies whether or not to include highlighting in the search results.
'highlight' => 'y', 'highlight' => 'y',
//'includeimagequickview' => $includeimagequickview, //'includeimagequickview' => $includeimagequickview,
//UPEI commented out //UPEI commented out
@ -600,7 +603,7 @@ class EBSCOAPI {
//UPEI commented out //UPEI commented out
//'styles' => $styles, //'styles' => $styles,
); );
if ($autosuggest == TRUE) { if ($autosuggest == TRUE) {
@ -667,14 +670,14 @@ class EBSCOAPI {
'format' => 'ris', 'format' => 'ris',
'styles' => $styles, 'styles' => $styles,
); );
$result = $this->request('Retrieve', $params); $result = $this->request('Retrieve', $params);
return $result; return $result;
} }
public function apiExport($an, $db) { public function apiExport($an, $db) {
@ -683,11 +686,11 @@ class EBSCOAPI {
'dbid' => $db, 'dbid' => $db,
'format' => 'ris' 'format' => 'ris'
); );
$result = $this->request('Export', $params); $result = $this->request('Export', $params);
return $result; return $result;
} }
public function apiCitationStyles($an, $db, $styles) { public function apiCitationStyles($an, $db, $styles) {
@ -697,14 +700,14 @@ class EBSCOAPI {
'dbid' => $db, 'dbid' => $db,
'styles' => $styles 'styles' => $styles
); );
$result = $this->request('CitationStyles', $params); $result = $this->request('CitationStyles', $params);
return $result; return $result;
} }
/** /**
* Wrapper for info API call. * Wrapper for info API call.
* *
@ -736,7 +739,7 @@ class EBSCOAPI {
return false; return false;
} }
} }
/** /**
* Handle a PEAR_Error. Return : * Handle a PEAR_Error. Return :

Loading…
Cancel
Save