Browse Source

match the d7 versions search results by not escapting brackets

2.x
Paul Pound 1 year 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) {
queries.push(query.query);
})
var query_str = encodeURI(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 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&profid=edsapi&mode=bool&lang=en&bquery=';
jQuery.each(data.documents, function (key, val) {
id = 'roblib-search-eds-article-' + counter;
divs[counter++] = id;

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

@ -115,7 +115,7 @@ class EBSCOAPI {
*
* @access public
*/
public function __construct($config) {
public function __construct($config) {
$this->config = $config;
}
@ -128,7 +128,7 @@ class EBSCOAPI {
*
* @access public
*/
public function authenticationToken(){
@ -158,7 +158,7 @@ class EBSCOAPI {
$_SESSION["authenticationTimeout"]= $result['authenticationTimeout'];
$_SESSION['autocompleteUrl'] = $result['autocompleteUrl'];
$_SESSION['autocompleteToken'] = $result['autocompleteToken'];
$_SESSION["autocompleteTokenTimeOut"]= $result['autocompleteTokenTimeOut'];
$_SESSION["autocompleteTokenTimeOut"]= $result['autocompleteTokenTimeOut'];
$_SESSION['autocompleteCustId'] = $result['autocompleteCustId'];
}
@ -168,11 +168,11 @@ class EBSCOAPI {
$_SESSION["authenticationTimeout"]= $result['authenticationTimeout'];
$_SESSION['autocompleteUrl'] = $result['autocompleteUrl'];
$_SESSION['autocompleteToken'] = $result['autocompleteToken'];
$_SESSION["autocompleteTokenTimeOut"]= $result['autocompleteTokenTimeOut'];
$_SESSION["autocompleteTokenTimeOut"]= $result['autocompleteTokenTimeOut'];
$_SESSION['autocompleteCustId'] = $result['autocompleteCustId'];
$result = array(
'authenticationToken' => $token,
@ -459,7 +459,10 @@ class EBSCOAPI {
$type = isset($search['index']) && !empty($search['index']) ? $search['index'] : 'AllFields';
// 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.
$term = preg_replace("/\s+/", ' ', $term);
@ -592,7 +595,7 @@ class EBSCOAPI {
// Specifies whether or not to include highlighting in the search results.
'highlight' => 'y',
//'includeimagequickview' => $includeimagequickview,
//UPEI commented out
@ -600,7 +603,7 @@ class EBSCOAPI {
//UPEI commented out
//'styles' => $styles,
);
if ($autosuggest == TRUE) {
@ -667,14 +670,14 @@ class EBSCOAPI {
'format' => 'ris',
'styles' => $styles,
);
$result = $this->request('Retrieve', $params);
$result = $this->request('Retrieve', $params);
return $result;
}
public function apiExport($an, $db) {
@ -683,11 +686,11 @@ class EBSCOAPI {
'dbid' => $db,
'format' => 'ris'
);
$result = $this->request('Export', $params);
return $result;
}
public function apiCitationStyles($an, $db, $styles) {
@ -697,14 +700,14 @@ class EBSCOAPI {
'dbid' => $db,
'styles' => $styles
);
$result = $this->request('CitationStyles', $params);
return $result;
}
/**
* Wrapper for info API call.
*
@ -736,7 +739,7 @@ class EBSCOAPI {
return false;
}
}
/**
* Handle a PEAR_Error. Return :

Loading…
Cancel
Save