blacklight 3.8.0 → 3.8.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.8.0
1
+ 3.8.1
@@ -95,6 +95,11 @@ module Blacklight::BlacklightHelperBehavior
95
95
  blacklight_config.index_fields
96
96
  end
97
97
 
98
+ def should_display_index_field? document, solr_field
99
+ document.has?(solr_field.field) ||
100
+ (document.has_highlight_field? solr_field.field if solr_field.highlight)
101
+ end
102
+
98
103
  def index_field_names
99
104
  index_fields.keys
100
105
  end
@@ -156,7 +161,7 @@ module Blacklight::BlacklightHelperBehavior
156
161
 
157
162
  # used in the catalog/_show/_default partial
158
163
  def document_show_fields
159
- blacklight_config.show_fields.keys
164
+ blacklight_config.show_fields
160
165
  end
161
166
 
162
167
  # used in the catalog/_show/_default partial
@@ -177,6 +182,11 @@ module Blacklight::BlacklightHelperBehavior
177
182
  render_field_value value
178
183
  end
179
184
 
185
+ def should_display_show_field? document, solr_field
186
+ document.has?(solr_field.field) ||
187
+ (document.has_highlight_field? solr_field.field if solr_field.highlight)
188
+ end
189
+
180
190
  def render_field_value value=nil
181
191
  value = [value] unless value.is_a? Array
182
192
  value = value.collect { |x| x.respond_to?(:force_encoding) ? x.force_encoding("UTF-8") : x}
@@ -2,7 +2,7 @@
2
2
  <dl class="defList">
3
3
 
4
4
  <% index_fields.each do |solr_fname, field| -%>
5
- <% if document.has? solr_fname %>
5
+ <% if should_display_index_field? document, field %>
6
6
  <dt class="blacklight-<%= solr_fname.parameterize %>"><%= render_index_field_label :field => solr_fname %></dt>
7
7
  <dd class="blacklight-<%= solr_fname.parameterize %>"><%= render_index_field_value :document => document, :field => solr_fname %></dd>
8
8
  <% end -%>
@@ -1,7 +1,7 @@
1
1
  <%# default partial to display solr document fields in catalog show view -%>
2
2
  <dl class="defList">
3
3
  <% document_show_fields.each do |solr_fname, field| -%>
4
- <% if document.has? solr_fname %>
4
+ <% if should_display_show_field? document, field %>
5
5
  <dt class="blacklight-<%= solr_fname.parameterize %>"><%= render_document_show_field_label :field => solr_fname %></dt>
6
6
  <dd class="blacklight-<%= solr_fname.parameterize %>"><%= render_document_show_field_value :document => document, :field => solr_fname %></dd>
7
7
  <% end -%>
@@ -6,20 +6,26 @@ module Blacklight
6
6
 
7
7
  # Set up Blacklight::Configuration.default_values to contain
8
8
  # the basic, required Blacklight fields
9
- class << self; attr_accessor :default_values; end
10
- @default_values = {
11
- :solr_request_handler => 'select',
12
- :default_solr_params => {},
13
- :document_solr_request_handler => nil,
14
- :default_document_solr_params => {},
15
- :show => OpenStructWithHashAccess.new(:html_title => SolrDocument.unique_key, :heading => SolrDocument.unique_key),
16
- :index => OpenStructWithHashAccess.new(:show_link => SolrDocument.unique_key),
17
- :spell_max => 5,
18
- :max_per_page => 100,
19
- :per_page => [10,20,50,100],
20
- :add_facet_fields_to_solr_request => false
21
- }
22
-
9
+ class << self
10
+ def default_values
11
+ @default_values ||= begin
12
+ unique_key = ((SolrDocument.unique_key if defined?(SolrDocument)) || 'id')
13
+
14
+ {
15
+ :solr_request_handler => 'select',
16
+ :default_solr_params => {},
17
+ :document_solr_request_handler => nil,
18
+ :default_document_solr_params => {},
19
+ :show => OpenStructWithHashAccess.new(:html_title => unique_key, :heading => unique_key),
20
+ :index => OpenStructWithHashAccess.new(:show_link => unique_key),
21
+ :spell_max => 5,
22
+ :max_per_page => 100,
23
+ :per_page => [10,20,50,100],
24
+ :add_facet_fields_to_solr_request => false
25
+ }
26
+ end
27
+ end
28
+ end
23
29
 
24
30
  # XXX this isn't very pretty, but it works.
25
31
  require 'blacklight/configuration/fields'
@@ -360,7 +360,7 @@ module Blacklight::SolrHelper
360
360
 
361
361
  solr_response = find(blacklight_config.solr_request_handler, self.solr_search_params(user_params).merge(extra_controller_params))
362
362
  document_list = solr_response.docs.collect {|doc| SolrDocument.new(doc, solr_response)}
363
- Rails.logger.debug("Solr response: #{solr_response.inspect}")
363
+ Rails.logger.debug("Solr response: #{solr_response.inspect}") if defined?(::BLACKLIGHT_VERBOSE_LOGGING) and ::BLACKLIGHT_VERBOSE_LOGGING
364
364
  Rails.logger.debug("Solr fetch: #{self.class}#get_search_results (#{'%.1f' % ((Time.now.to_f - bench_start.to_f)*1000)}ms)")
365
365
 
366
366
  return [solr_response, document_list]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.8.0
4
+ version: 3.8.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -17,7 +17,7 @@ authors:
17
17
  autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
- date: 2012-11-02 00:00:00.000000000 Z
20
+ date: 2012-11-04 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails
@@ -508,7 +508,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
508
508
  version: '0'
509
509
  segments:
510
510
  - 0
511
- hash: -3050377984529966753
511
+ hash: -1025939682679006516
512
512
  required_rubygems_version: !ruby/object:Gem::Requirement
513
513
  none: false
514
514
  requirements:
@@ -517,7 +517,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
517
517
  version: '0'
518
518
  segments:
519
519
  - 0
520
- hash: -3050377984529966753
520
+ hash: -1025939682679006516
521
521
  requirements: []
522
522
  rubyforge_project: blacklight
523
523
  rubygems_version: 1.8.23