@ -1,10 +1,10 @@
Drupal . behaviors . roblib _search _solr _site _results = {
attach : function ( context , settings ) {
attach : function ( context , settings ) {
url = settings . roblib _search _solr _site _results . search _url ;
query = settings . roblib _search _solr _site _results . search _query ;
baseUrl = settings . roblib _search _solr _site _results . base _url ;
default _site _type = settings . roblib _search _solr _site _results . default _site _type + '/' ;
jQuery . getJSON ( url , function ( data ) {
jQuery . getJSON ( url , function ( data ) {
var items = [ ] ;
total _found = data . response . numFound ;
var numberOfDocs = 0 ;
@ -21,25 +21,22 @@ Drupal.behaviors.roblib_search_solr_site_results = {
var counter = 0 ;
var divs = new Array ( ) ;
var content = new Array ( ) ;
jQuery . each ( data . response . docs , function ( key , val ) {
jQuery . each ( data . response . docs , function ( key , val ) {
id = 'roblib_search_solr_results_' + counter ;
content [ counter ] = val . teaser ;
divs [ counter ++ ] = id ;
items . push ( '<div class ="roblib-search-row" id="' + id + ' " > \ n \
items . push ( '<div class ="roblib-search-row" id="' + id + ' " > \ n \
< span class = "roblib-title results" > \ n \
< a href = "' + val.url + '" > ' + val.label + ' < / a > < / s p a n > ' +
'\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 ( '' ) ) ;
}
if ( numberOfDocs > 0 )
{
jQuery ( '#' + 'roblib-search-solr-site-results-more' ) . empty ( ) . append ( '<a href="' + baseUrl + '/search/' + default _site _type + query + '"' + '>see all results ('
+ total _found + ') </a>' ) ;
jQuery ( '.' + 'roblib-solr-more-results' ) . empty ( ) . append ( '<a href="' + baseUrl + '/search/' + default _site _type + query + '"' + '>see all results ('
+ total _found + ') </a>' ) ;
roblib - solr - more - results
if ( numberOfDocs > 0 ) {
results _url = '<a href="' + baseUrl + '/search/' + default _site _type + query + '?f[0]=(-bundle:bestbet)"' + '>see all results ('
+ total _found + ') </a>' ;
jQuery ( '#' + 'roblib-search-solr-site-results-more' ) . empty ( ) . append ( results _url ) ;
jQuery ( '#' + 'roblib-solr-more-results-results' ) . empty ( ) . append ( results _url ) ;
}
} ) ;
}