Sha256: c96c58d53d7ca313d37e0dc6ede7f7629901161423ff411b5a8d5cf700951ea1
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
# View Helper methods for Hydra Collections in search results module CollectionsSearchHelper def collection_name(collection_pid) # junk, pid = collection_pid.split('/') escaped_pid = collection_pid.sub(':', '\:') solr_opts = {params: {:q=>"id:#{escaped_pid}"}} result = Blacklight.solr.get("select", solr_opts) docs = result["response"]["docs"] if docs if docs.first[Solrizer.solr_name(:title, :displayable)] res = docs.first[Solrizer.solr_name(:title, :displayable)] res.kind_of?(Array) ? res.first : res else logger.warn "#{docs.first['id']} does not have a #{Solrizer.solr_name(:title, :displayable)} in solr" docs.first['id'] end else 'Not Found' end end def display_value_for_facet(facet, value) if facet == Solrizer.solr_name(:collection, :facetable) collection_name(value) elsif ['release_date_desc_facet', 'last_update_date_desc_facet'].include? facet Narm::DateFacet.decode(value) else value end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hydra-collections-1.0.0 | app/helpers/collections_search_helper.rb |