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. 5
      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;

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

@ -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);

Loading…
Cancel
Save