Browse Source

added bundle name and totol results found to solr result target

2.x-ebsco
Paul Pound 7 years ago
parent
commit
81f1970f3d
  1. 17
      targets/solr_site/css/roblib_search_solr_site.css
  2. 11
      targets/solr_site/js/solr_site_results.js

17
targets/solr_site/css/roblib_search_solr_site.css

@ -7,3 +7,20 @@
*/ */
.solr-site-results {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
word-wrap: break-word;
margin-right: 5px;
width: 100%;
}
.roblib-solr-bundle {
font-weight: lighter;
color: gray;
}

11
targets/solr_site/js/solr_site_results.js

@ -6,6 +6,7 @@ Drupal.behaviors.roblib_search_solr_site_results = {
default_site_type = settings.roblib_search_solr_site_results.default_site_type + '/'; default_site_type = settings.roblib_search_solr_site_results.default_site_type + '/';
jQuery.getJSON(url, function(data) { jQuery.getJSON(url, function(data) {
var items = []; var items = [];
total_found = data.response.numFound;
var numberOfDocs = 0; var numberOfDocs = 0;
try { try {
numberOfDocs = data.response.docs.length; numberOfDocs = data.response.docs.length;
@ -16,7 +17,6 @@ Drupal.behaviors.roblib_search_solr_site_results = {
jQuery('#' + 'roblib-search-content-solr-site-results').empty().append('No Results'); jQuery('#' + 'roblib-search-content-solr-site-results').empty().append('No Results');
jQuery('.' + 'pane-roblib-search-solr-site-roblib-search-solr-site-results').hide(); jQuery('.' + 'pane-roblib-search-solr-site-roblib-search-solr-site-results').hide();
} else { } else {
jQuery('#' + 'roblib-search-content-solr-site-results').empty(); jQuery('#' + 'roblib-search-content-solr-site-results').empty();
var counter = 0; var counter = 0;
var divs = new Array(); var divs = new Array();
@ -26,15 +26,16 @@ Drupal.behaviors.roblib_search_solr_site_results = {
content[counter] = val.teaser; content[counter] = val.teaser;
divs[counter++] = id; divs[counter++] = id;
items.push('<div class ="roblib-search-row" id="'+ id +'">\n\ items.push('<div class ="roblib-search-row" id="'+ id +'">\n\
<div class="roblib-title results">\n\ <span class="roblib-title results">\n\
<a href="' + val.url + '">' + val.label + '</a></div></div>'); <a href="' + val.url + '">' + val.label + '</a></span>' +
'\n\<span class="roblib-solr-bundle">(' + val.bundle_name + ')</span> <span class="roblib-solr-teaser"> ' + val.teaser + '</span></div>');
}); });
jQuery('#' + 'roblib-search-content-solr-site-results').empty().append(items.join('')); jQuery('#' + 'roblib-search-content-solr-site-results').empty().append(items.join(''));
} }
if (numberOfDocs > 0) if (numberOfDocs > 0)
{ {
jQuery('#' + 'roblib-search-solr-site-results-more').empty().append('<a href="'+ baseUrl + '/search/' + default_site_type + query +'"' + '>see all results</a>'); jQuery('#' + 'roblib-search-solr-site-results-more').empty().append('<a href="'+ baseUrl + '/search/' + default_site_type + query +'"' + '>see all results ('
+ total_found + ') </a>');
} }
}); });
} }

Loading…
Cancel
Save