Browse Source

encode the query string before sending to solr

2.x-ebsco
ppound 5 years ago
parent
commit
52e65f7898
  1. 3
      targets/solr_site/roblib_search_solr_site.module

3
targets/solr_site/roblib_search_solr_site.module

@ -356,7 +356,8 @@ function roblib_search_solr_site_add_url($json) {
function roblib_search_solr_site_get_results($query_string = NULL, $type) { function roblib_search_solr_site_get_results($query_string = NULL, $type) {
$num_results = variable_get('roblib_search_solr_site_num_results', '5'); $num_results = variable_get('roblib_search_solr_site_num_results', '5');
$query = apachesolr_drupal_query("apachesolr"); $query = apachesolr_drupal_query("apachesolr");
$query->addParam('q', $query_string ); // keyword to be searched $encoded_query = htmlentities($query_string, ENT_QUOTES);
$query->addParam('q', $encoded_query); // keyword to be searched
$query->addParam('rows', $num_results); $query->addParam('rows', $num_results);
$query->addParam('fq', $type); $query->addParam('fq', $type);
$query->addParam('mm', '1'); $query->addParam('mm', '1');

Loading…
Cancel
Save