(function ($) { AjaxSolr.theme.prototype.result = function (doc) { // here check for label or title var label = doc.id; if(SindiceHelper.replacePrefix){ label = SindiceHelper.replacePrefix(doc.id); } if(doc.title && doc.title.length>0){ label = doc.title[0]; }else if(doc.label && doc.label.length>0){ label = doc.label[0]; } var output = '

' + label + '

'; output += ''; for (field in doc) { if (field == 'id') { continue; } if (doc[field] instanceof Array){ var value = '' } else { value = doc[field]; if(SindiceHelper.shortenLongWords){ value = SindiceHelper.shortenLongWords(value,100,40); } } // here shorten links if(SindiceHelper.replacePrefix){ value = SindiceHelper.replacePrefix(value); } output += ''; } output += '
' + field + ':' +value+ '
'; return output; }; AjaxSolr.theme.prototype.extra = function (id,doc) { // get an image for Compounds if(doc.id.indexOf("http://hcls.sindice.com/chembl:chembl_compound_")==0){ //console.log(id); //console.log(doc.id); var query = "PREFIX : "+ " SELECT *"+ " WHERE {"+ " <"+doc.id+"> :standard_inchi_key [ rdf:value ?o] ."+ "}"; /* $.ajax({ url:"http://hcls.sindice.com/sparql", dataType:"json", data:{ query:query, format:"application/sparql-results+json" }, success:function(json){ console.log(json) } }) */ } }; AjaxSolr.theme.prototype.snippet = function (doc) { var output = ''; if (doc.hasDescription.length > 300) { output += doc.dateline + ' ' + doc.text.substring(0, 300); output += '' + doc.text.substring(300); output += ' more'; } else { output += doc.dateline + ' ' + doc.hasDescription; } return output; }; AjaxSolr.theme.prototype.tag = function (value, weight, handler) { return $('').text(value).addClass('tagcloud_size_' + weight).click(handler); }; AjaxSolr.theme.prototype.facet_container = function (title, name) { return $('#facets').append('

').text(title); }; /** * Create a list with counts for each facet value and a link to filter with it */ AjaxSolr.theme.prototype.facet = function (facet) { var list = $('