diff --git a/app/views/search/_generic.rhtml b/app/views/search/_generic.rhtml index bbfa7e707..8f8ab8b51 100644 --- a/app/views/search/_generic.rhtml +++ b/app/views/search/_generic.rhtml @@ -2,6 +2,11 @@

<%= link_to h(title), source_url, :tabindex => '1' %>

+ <% if topic_types %> +
+ Topic type: <%= topic_types.last %> +
+ <% end %>
<%= strip_tags(short_summary) %>
diff --git a/app/views/search/_results.rhtml b/app/views/search/_results.rhtml index e3eae6436..495676386 100644 --- a/app/views/search/_results.rhtml +++ b/app/views/search/_results.rhtml @@ -91,7 +91,8 @@ :short_summary => result[:short_summary], :related => result[:related], :result => result[:id], - :first_result => (index == 0) } -%> + :first_result => (index == 0), + :topic_types => result[:topic_types] } -%> <% if result[:class] == 'StillImage' %> <%= render(:partial => "image", :locals => locals.merge({ :locally_hosted => result[:locally_hosted], diff --git a/lib/zoom_search.rb b/lib/zoom_search.rb index 021a46abd..153fd4e49 100644 --- a/lib/zoom_search.rb +++ b/lib/zoom_search.rb @@ -238,6 +238,14 @@ def parse_from_xml_in(zoom_record) result_hash[field_name.to_sym] = field_value end + # determine the topic type(s) + topic_type_names = TopicType.all(:select => 'name').collect { |topic_type| topic_type.name } + result_hash[:topic_types] = Array.new + oai_dc.xpath(".//dc:coverage", oai_dc.namespaces).each do |node| + value = node.content.strip + result_hash[:topic_types] << value if topic_type_names.include?(value) + end + # get coverage values, these can be used for geographic values or temporal information location_or_temporal_nodes = oai_dc.xpath(".//dc:coverage", oai_dc.namespaces).select { |node| !node.content.scan(":").blank? }