function parseSolrResults(resultJson) {
    var docs = resultJson["response"]["docs"];
    var html = [];
    for (var i = 0; i < docs.length; i++) {
        var doc = docs[i];
        var names = doc["origin"].join(", ") + " ";
        var date = "(Published " + doc["datePublished"].slice(0, 10) + ")";
        var link = doc["resourceMap"][0];
        if (link.slice(0, 4) === "doi:") {
            link = "http://dx.doi.org/" + link.slice(4);
        }
        var title = '<a rel="external" href="' + link + '" target="_blank">' + 
                    doc["title"].trim() + '</a>';
        var row = '<p><span class="dataset-title">' + title + 
                  '</span><br><span class="dataset-author">' + names + date +
                  '</span></p>';
        html.push(row);
    }
    if (html.length) {
        return html.join("\n");
    }
    else {
        return "<p>Your search returned no results.</p>";
    }
}
// Parse Solr search results into HTML
Parse Solr search results into HTML
Parse Solr search results into HTML
function parseSolrResults(resultJson) {
    var docs = resultJson["response"]["docs"];
    var html = [];
    for (var i = 0; i < docs.length; i++) {
        var doc = docs[i];
        var names = doc["origin"].join(", ") + " ";
        var date = "(Published " + doc["datePublished"].slice(0, 10) + ")";
        var link = doc["resourceMap"][0];
        if (link.slice(0, 4) === "doi:") {
            link = "http://dx.doi.org/" + link.slice(4);
        }
        var title = '<a rel="external" href="' + link + '" target="_blank">' + 
                    doc["title"].trim() + '</a>';
        var row = '<p><span class="dataset-title">' + title + 
                  '</span><br><span class="dataset-author">' + names + date +
                  '</span></p>';
        html.push(row);
    }
    if (html.length) {
        return html.join("\n");
    }
    else {
        return "<p>Your search returned no results.</p>";
    }
}
function parseSolrResults ( resultJson ) { var docs = resultJson [ "response" ] [ "docs" ] ; var html = [ ] ; for ( var i = 0 ; i < docs . length ; i ++ ) { var doc = docs [ i ] ; var names = doc [ "origin" ] . join ( ", " ) + " " ; var date = "(Published " + doc [ "datePublished" ] . slice ( 0 , 10 ) + ")" ; var link = doc [ "resourceMap" ] [ 0 ] ; if ( link . slice ( 0 , 4 ) === "doi:" ) { link = "http://dx.doi.org/" + link . slice ( 4 ) ; } var title = '<a rel="external" href="' + link + '" target="_blank">' + doc [ "title" ] . trim ( ) + '</a>' ; var row = '<p><span class="dataset-title">' + title + '</span><br><span class="dataset-author">' + names + date + '</span></p>' ; html . push ( row ) ; } if ( html . length ) { return html . join ( "\n" ) ; } else { return "<p>Your search returned no results.</p>" ; } }
Parse Solr search results into HTML
Parse Solr search results into HTML