blacklight 5.3.0 → 5.4.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -1
  3. data/VERSION +1 -1
  4. data/app/assets/javascripts/blacklight/blacklight.js +1 -0
  5. data/app/assets/javascripts/blacklight/collapsable.js +9 -0
  6. data/app/controllers/bookmarks_controller.rb +72 -9
  7. data/app/helpers/blacklight/blacklight_helper_behavior.rb +15 -7
  8. data/app/helpers/blacklight/catalog_helper_behavior.rb +17 -9
  9. data/app/helpers/blacklight/configuration_helper_behavior.rb +59 -7
  10. data/app/helpers/blacklight/facets_helper_behavior.rb +1 -16
  11. data/app/helpers/blacklight/url_helper_behavior.rb +21 -2
  12. data/app/models/bookmark.rb +13 -4
  13. data/app/models/solr_document.rb +5 -0
  14. data/app/views/bookmarks/_tools.html.erb +10 -11
  15. data/app/views/catalog/_bookmark_control.html.erb +2 -2
  16. data/app/views/catalog/_refworks_form.html.erb +3 -2
  17. data/app/views/catalog/_sort_widget.html.erb +5 -5
  18. data/app/views/catalog/_view_type_group.html.erb +2 -2
  19. data/app/views/shared/_header_navbar.html.erb +1 -3
  20. data/config/locales/blacklight.pt-BR.yml +223 -0
  21. data/db/migrate/20140320000000_add_polymorphic_type_to_bookmarks.rb +8 -0
  22. data/gemfiles/rails4.1.gemfile +1 -1
  23. data/lib/blacklight.rb +5 -0
  24. data/lib/blacklight/catalog.rb +33 -5
  25. data/lib/blacklight/configuration.rb +12 -3
  26. data/lib/blacklight/configuration/facet_field.rb +1 -1
  27. data/lib/blacklight/configuration/search_field.rb +3 -2
  28. data/lib/blacklight/configuration/solr_field.rb +2 -1
  29. data/lib/blacklight/configuration/sort_field.rb +2 -1
  30. data/lib/blacklight/engine.rb +9 -1
  31. data/lib/blacklight/exceptions.rb +3 -0
  32. data/lib/blacklight/rails/routes.rb +12 -0
  33. data/lib/blacklight/request_builders.rb +19 -18
  34. data/lib/blacklight/search_fields.rb +0 -9
  35. data/lib/blacklight/solr/document.rb +15 -0
  36. data/lib/blacklight/solr/document/export.rb +4 -0
  37. data/lib/blacklight/solr_helper.rb +25 -28
  38. data/lib/blacklight/solr_response.rb +31 -29
  39. data/lib/blacklight/solr_response/response.rb +18 -0
  40. data/lib/blacklight/user.rb +17 -4
  41. data/lib/blacklight/utils.rb +30 -2
  42. data/lib/generators/blacklight/install_generator.rb +4 -0
  43. data/lib/generators/blacklight/templates/config/initializers/blacklight_initializer.rb +9 -0
  44. data/spec/controllers/application_controller_spec.rb +0 -1
  45. data/spec/controllers/bookmarks_controller_spec.rb +8 -4
  46. data/spec/controllers/catalog_controller_spec.rb +48 -55
  47. data/spec/controllers/saved_searches_controller_spec.rb +1 -4
  48. data/spec/controllers/search_history_controller_spec.rb +0 -1
  49. data/spec/features/bookmarks_spec.rb +14 -0
  50. data/spec/features/search_formats_spec.rb +45 -0
  51. data/spec/helpers/blacklight_helper_spec.rb +71 -30
  52. data/spec/helpers/configuration_helper_spec.rb +128 -4
  53. data/spec/helpers/facets_helper_spec.rb +1 -1
  54. data/spec/lib/blacklight/configuration_spec.rb +0 -5
  55. data/spec/lib/blacklight/search_fields_spec.rb +0 -22
  56. data/spec/lib/blacklight/solr/document_spec.rb +6 -0
  57. data/spec/lib/blacklight/solr_helper_spec.rb +31 -10
  58. data/spec/lib/blacklight/solr_response_spec.rb +8 -0
  59. data/spec/lib/blacklight/user_spec.rb +38 -4
  60. data/spec/models/bookmark_spec.rb +22 -17
  61. data/spec/spec_helper.rb +2 -0
  62. data/template.demo.rb +4 -9
  63. metadata +12 -6
  64. data/spec/data/sample_docs.yml +0 -655
@@ -0,0 +1,5 @@
1
+ class SolrDocument
2
+
3
+ include Blacklight::Solr::Document
4
+
5
+ end
@@ -1,12 +1,11 @@
1
- <ul class="bookmarkTools nav nav-pills">
2
- <li class="cite">
3
- <%= link_to t('blacklight.tools.cite'), citation_catalog_path(:sort=>params[:sort], :per_page=>params[:per_page], :id => @bookmarks.collect{|doc| doc.document_id}), {:id => 'citeLink', :name => 'citation', :class => 'btn btn-default', :data => {:ajax_modal => "trigger"}} %>
4
- </li>
5
- <% if defined? BlacklightMarc %>
6
- <%= render partial: 'bookmarks/refworks' %>
7
- <%= render partial: 'bookmarks/endnote' %>
8
- <% end %>
9
- <li class="email">
10
- <%= link_to t('blacklight.tools.email'), email_catalog_path(:sort=>params[:sort], :per_page=>params[:per_page], :id => @bookmarks.collect {|doc| doc.document_id}), :class=>"btn btn-default", :id => "emailLink", :data => {:ajax_modal => "trigger"} %>
11
- </li>
1
+ <ul class="bookmarkTools nav nav-pills">
2
+ <li class="cite">
3
+ <%= link_to t('blacklight.tools.cite'), citation_catalog_path(:sort=>params[:sort], :per_page=>params[:per_page], :id => @response.documents.map {|doc| doc.id}), {:id => 'citeLink', :name => 'citation', :class => 'btn btn-default', :data => {:ajax_modal => "trigger"}} %>
4
+ </li>
5
+
6
+ <li class="email">
7
+ <%= link_to t('blacklight.tools.email'), email_catalog_path(:sort=>params[:sort], :per_page=>params[:per_page], :id => @response.documents.map {|doc| doc.id}), :class=>"btn btn-default", :id => "emailLink", :data => {:ajax_modal => "trigger"} %>
8
+ </li>
9
+
10
+ <%= render_marc_tools %>
12
11
  </ul>
@@ -3,8 +3,8 @@
3
3
  # Note these two forms are pretty similar but for different :methods, classes, and labels.
4
4
  # but it was simpler to leave them seperate instead of DRYing them, got confusing trying that.
5
5
  # the data-doc-id attribute is used by our JS that converts to a checkbox/label.
6
- -%>
7
- <% unless current_or_guest_user.document_is_bookmarked? document.id %>
6
+ -%>
7
+ <% if current_bookmarks.find { |x| x.document_id == document.id and x.document_type == document.class }.blank? %>
8
8
 
9
9
  <%= form_tag( bookmark_path( document ), :method => :put, :class => "bookmark_toggle", "data-doc-id" => document.id, :'data-present' => t('blacklight.search.bookmarks.present'), :'data-absent' => t('blacklight.search.bookmarks.absent'), :'data-inprogress' => t('blacklight.search.bookmarks.inprogress')) do %>
10
10
  <%= submit_tag(t('blacklight.bookmarks.add.button'), :id => "bookmark_toggle_#{document.id.to_s.parameterize}", :class => "bookmark_add") %>
@@ -1,5 +1,6 @@
1
- <%= form_tag "http://www.refworks.com/express/expressimport.asp?vendor=#{application_name}&filter=MARC%20Format&encoding=65001", :name => "refworks", :role => 'form', :target => "_blank", :id => "refworks-form" do %>
1
+ <%# this partial is used by blacklight-marc 5.0 %>
2
+ <%= form_tag refworks_export_url, :name => "refworks", :role => 'form', :target => "_blank", :id => "refworks-form" do %>
2
3
 
3
4
  <%= hidden_field_tag "ImportData", render_refworks_texts(documents) %>
4
5
  <%= submit_tag t('blacklight.tools.refworks'), :class => 'submit btn btn-default'%>
5
- <% end %>
6
+ <% end %>
@@ -1,13 +1,13 @@
1
- <% if show_sort_and_per_page? and !blacklight_config.sort_fields.blank? %>
1
+ <% if show_sort_and_per_page? and !active_sort_fields.blank? %>
2
2
  <div id="sort-dropdown" class="btn-group">
3
3
  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
4
4
  <%= link_to(t('blacklight.search.sort.label', :field =>current_sort_field.label), "#") %> <span class="caret"></span>
5
5
  </button>
6
6
 
7
7
  <ul class="dropdown-menu">
8
- <%- blacklight_config.sort_fields.each do |sort_key, field| %>
9
- <li><%= link_to(field.label, url_for(params_for_search(:sort => sort_key))) %></li>
10
- <%- end -%>
8
+ <%- active_sort_fields.each do |sort_key, field_config| %>
9
+ <li><%= link_to(field_config.label, url_for(params_for_search(:sort => sort_key))) %></li>
10
+ <%- end -%>
11
11
  </ul>
12
12
  </div>
13
- <% end %>
13
+ <% end %>
@@ -2,7 +2,7 @@
2
2
  <div class="view-type">
3
3
  <span class="sr-only"><%= t('blacklight.search.view_title') %></span>
4
4
  <div class="view-type-group btn-group">
5
- <% blacklight_config.view.keys.each do |view| %>
5
+ <% document_index_views.each do |view, config| %>
6
6
  <%= link_to url_for(params.merge(:view => view)), :title => t("blacklight.search.view_title.#{view}", default: t("blacklight.search.view.#{view}", default: blacklight_config.view[view].title)), :class => "btn btn-default view-type-#{ view.to_s.parameterize } #{"active" if document_index_view_type == view}" do %>
7
7
  <%= render_view_type_group_icon view %>
8
8
  <span class="caption"><%= t("blacklight.search.view.#{view}") %></span>
@@ -10,4 +10,4 @@
10
10
  <% end %>
11
11
  </div>
12
12
  </div>
13
- <% end -%>
13
+ <% end -%>
@@ -18,8 +18,6 @@
18
18
 
19
19
  <div id="search-navbar" class="navbar navbar-default navbar-static-top" role="navigation">
20
20
  <div class="container">
21
- <div class="navbar-header">
22
21
  <%= render_search_bar %>
23
- </div>
24
22
  </div>
25
- </div>
23
+ </div>
@@ -0,0 +1,223 @@
1
+ pt-BR:
2
+ active_record:
3
+ models:
4
+ feedback: 'Feedback'
5
+ attributes:
6
+ feedback:
7
+ name: 'Seu Nome'
8
+ email: 'Seu Email'
9
+ message: 'Sua Mensagem'
10
+ views:
11
+ pagination:
12
+ first: '&laquo; primeiro'
13
+ last: 'último &raquo;'
14
+ previous: '&laquo; anterior'
15
+ next: 'próximo &raquo;'
16
+ truncate: '…'
17
+
18
+ pagination_compact:
19
+ previous: '&laquo; ant'
20
+ next: 'próx &raquo;'
21
+
22
+ blacklight:
23
+ application_name: 'Blacklight'
24
+
25
+ header_links:
26
+ login: 'Acessar'
27
+ logout: 'Sair'
28
+ bookmarks: 'Favoritos'
29
+ saved_searches: 'Buscas Salvas'
30
+ search_history: 'Histórico'
31
+
32
+ welcome: 'Bem-Vindo!'
33
+ and: 'e'
34
+ or: 'ou'
35
+
36
+ bookmarks:
37
+ collection:
38
+ add:
39
+ button: 'Adicionar aos Favoritos'
40
+ title: 'Favoritos'
41
+ no_bookmarks: 'Você não salvou nenhum Favorito'
42
+ add:
43
+ button: 'Favorito'
44
+ success:
45
+ one: 'Favorito Adicionado.'
46
+ other: 'Favoritos Adicionados.'
47
+ failure: 'Xiii, ocorreu um erro ao salvar o favorito.'
48
+ remove:
49
+ button: 'Remover favorito'
50
+ success: 'Favorito removido.'
51
+ failure: 'Xiii, ocorreu um erro a remover o favorito.'
52
+ action_confirm: 'Remover este favorito?'
53
+ clear:
54
+ action_title: 'Limpar favoritos'
55
+ action_confirm: 'Deseja limpar seus favoritos?'
56
+ success: 'Seus favoritos está limpo.'
57
+ failure: 'Xiii, ocorreu um erro ao limpar seus favoritos.'
58
+ need_login: 'Faça o login para ver ou modificar seus favoritos.'
59
+ list_title: 'Seus Favoritos'
60
+ delete: 'Excluir'
61
+
62
+ feedback:
63
+ valid_name: 'Preencha o Nome'
64
+ valid_email: 'Verifique seu endereço de email'
65
+ need_message: 'Escreva uma mensagem'
66
+ submit: 'Enviar!'
67
+ errors:
68
+ title: 'Por favor corrija os seguintes erros no formulário:'
69
+ complete:
70
+ title: 'Obrigado por seu contato'
71
+
72
+ saved_searches:
73
+ add:
74
+ success: 'Sua busca foi salva.'
75
+ failure: 'Xiii, ocorreu um erro ao salvar sua pesquisa.'
76
+ remove:
77
+ success: 'A busca salva foi excluída.'
78
+ failure: 'Xiii, ocorreu um erro ao excluir sua pesquisa.'
79
+ clear:
80
+ action_title: 'Limpar Buscas Salvas'
81
+ action_confirm: 'Deseja Excluir as Buscas Salvas?'
82
+ success: 'As buscas foram removidas.'
83
+ failure: 'Xiii, ocorreu um erro ao remover suas pesquisas.'
84
+ title: 'Pesquisas Salvas'
85
+ need_login: 'Por favor faça o login para gerenciar suas buscas salvas.'
86
+ no_searches: 'Você não salvou nenhuma busca'
87
+ list_title: 'Suas Buscas'
88
+ delete: 'excluir'
89
+
90
+ search_history:
91
+ clear:
92
+ action_title: 'Limpar Histórico de Busca'
93
+ action_confirm: 'Deseja limpar o histórico de Busca?'
94
+ success: 'Histórico de Busca removido.'
95
+ failure: 'Xiii, ocorreu um erro ao remover o histórico de busca.'
96
+ title: 'Histórico de Busca'
97
+ no_history: 'Não existe nada em seu histórico'
98
+ recent: 'Buscas Recentes'
99
+ forget: 'limpar'
100
+ save: 'salvar'
101
+
102
+ tools:
103
+ title: 'Ferramentas'
104
+ cite: 'Citar'
105
+ endnote: 'Exportar para EndNote'
106
+ refworks: 'Exportar para Refworks'
107
+ email: 'Email'
108
+ sms: 'SMS'
109
+ librarian_view: 'Librarian View'
110
+ clear: 'Limpar'
111
+
112
+ citation:
113
+ mla: 'MLA'
114
+ apa: 'APA'
115
+ chicago: 'Chicago'
116
+
117
+ email:
118
+ form:
119
+ title: 'Enviar por Email'
120
+ to: 'Email:'
121
+ message: 'Mensagem:'
122
+ submit: 'Enviar'
123
+ text:
124
+ title: 'Título: %{value}'
125
+ author: 'Autor: %{value}'
126
+ format: 'Formato: %{value}'
127
+ language: 'Idioma: %{value}'
128
+ subject:
129
+ one: 'Item: %{title}'
130
+ other: 'Itens'
131
+ url: 'URL: %{url}'
132
+ message: 'Mensagem: %{message}'
133
+
134
+ errors:
135
+ to:
136
+ invalid: 'Verifique seu endereço de email'
137
+ blank: 'Você precisa especificar um destinaário para enviar esta mensagem'
138
+ sms:
139
+ form:
140
+ title: 'Enviar por SMS'
141
+ to: 'Celular:'
142
+ carrier: 'Operadora'
143
+ carrier_prompt: 'Selecione a Operadora'
144
+ submit: 'Enviar'
145
+ text:
146
+ title: '%{value}'
147
+ author: ' por %{value}'
148
+ url: 'Link: %{url}'
149
+ errors:
150
+ to:
151
+ invalid: 'Você precisa digitar um número de telefone válido'
152
+ blank: "Você precisa digitar o número de telefone do destinatário para enviar uma mensagem"
153
+ carrier:
154
+ blank: 'Você precisa selecionar a operadora'
155
+
156
+ back_to_search: 'Voltar a busca'
157
+ back_to_bookmarks: 'Voltar aos Favoritos'
158
+
159
+ search:
160
+ title: '%{application_name} Resultado da Busca'
161
+ search_results_header: 'Busca'
162
+ search_results: 'Resultados da Busca'
163
+ errors:
164
+ request_error: "Desculpe, Eu não compreendi sua busca."
165
+ invalid_solr_id: "Desculpe, você solicitou um cadastro que não existe."
166
+ per_page:
167
+ label: '%{count}<span class="hide-text"> por página</span>'
168
+ button_label: '%{count} por página'
169
+ title: 'Número de resultados para mostrar por página'
170
+ submit: 'Atualizar'
171
+ sort:
172
+ label: 'Ordenar por %{field}'
173
+ submit: 'ordenar resultados'
174
+ form:
175
+ search_field:
176
+ label: 'Procurar em'
177
+ title: 'Opções da Busca'
178
+ post_label: 'por'
179
+ q: 'Busca...'
180
+ submit: 'Buscar'
181
+ pagination:
182
+ title: 'Navegação nos Resultados'
183
+ pagination_info:
184
+ no_items_found: 'Nenhum resultado encontrado para %{entry_name}'
185
+ single_item_found: '<strong>1</strong> para <strong>1</strong> de <strong>1</strong>'
186
+ pages:
187
+ one: '<strong>%{start_num}</strong> - <strong>%{end_num}</strong> de <strong>%{total_num}</strong>'
188
+ other: '<strong>%{start_num}</strong> - <strong>%{end_num}</strong> de <strong>%{total_num}</strong>'
189
+ entry_pagination_info:
190
+ one: '<strong>1 de 1</strong>'
191
+ other: '<strong>%{current}</strong> de <strong>%{total}</strong>'
192
+ documents:
193
+ counter: '%{counter}. '
194
+ facets:
195
+ title: 'Filtre sua busca'
196
+ sort:
197
+ count: 'Ordenar por Número'
198
+ index: 'Ordem Alfabética A-Z'
199
+ count: '%{number}'
200
+ more: 'mais »'
201
+ selected:
202
+ remove: '[remover]'
203
+ filters:
204
+ title: 'Sua busca por:'
205
+ label: '%{label}:'
206
+ remove:
207
+ value: 'Remover filtro %{value}'
208
+ label_value: 'Remover %{label}: %{value}'
209
+ librarian_view:
210
+ title: 'Librarian View'
211
+ leader: 'LEADER %{leader}'
212
+ start_over: 'refazer busca'
213
+ show:
214
+ title: '%{document_title} - %{application_name}'
215
+ rss_feed: 'RSS para resultadoss'
216
+ atom_feed: 'Atom para resultados'
217
+ fields:
218
+ default: 'Palavra-chave'
219
+
220
+ entry_name:
221
+ default: 'registro'
222
+
223
+ did_you_mean: 'Você quis dizer: %{options}?'
@@ -0,0 +1,8 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class AddPolymorphicTypeToBookmarks < ActiveRecord::Migration
3
+ def change
4
+ add_column(:bookmarks, :document_type, :string)
5
+
6
+ add_index :bookmarks, :user_id
7
+ end
8
+ end
@@ -9,4 +9,4 @@ end
9
9
  gem 'sass', '~> 3.2.15'
10
10
  gem 'sprockets', '~> 2.11.0'
11
11
 
12
- gem 'rails', '4.1.0.rc1'
12
+ gem 'rails', '4.1.0'
@@ -36,6 +36,11 @@ module Blacklight
36
36
  attr_accessor :solr, :solr_config
37
37
  end
38
38
 
39
+ # Secret key used to share session information with
40
+ # other services (e.g. refworks callback urls)
41
+ mattr_accessor :secret_key
42
+ @@secret_key = nil
43
+
39
44
  def self.solr_file
40
45
  "#{::Rails.root.to_s}/config/solr.yml"
41
46
  end
@@ -21,7 +21,6 @@ module Blacklight::Catalog
21
21
 
22
22
  # get search results from the solr index
23
23
  def index
24
-
25
24
  (@response, @document_list) = get_search_results
26
25
 
27
26
  respond_to do |format|
@@ -33,12 +32,13 @@ module Blacklight::Catalog
33
32
  end
34
33
 
35
34
  additional_response_formats(format)
35
+ document_export_formats(format)
36
36
  end
37
37
  end
38
38
 
39
39
  # get single document from the solr index
40
40
  def show
41
- @response, @document = get_solr_response_for_doc_id
41
+ @response, @document = get_solr_response_for_doc_id
42
42
 
43
43
  respond_to do |format|
44
44
  format.html {setup_next_and_previous_documents}
@@ -103,7 +103,7 @@ module Blacklight::Catalog
103
103
 
104
104
  # citation action
105
105
  def citation
106
- @response, @documents = get_solr_response_for_field_values(SolrDocument.unique_key,params[:id])
106
+ @response, @documents = get_solr_response_for_document_ids(params[:id])
107
107
  respond_to do |format|
108
108
  format.html
109
109
  format.js { render :layout => false }
@@ -113,7 +113,7 @@ module Blacklight::Catalog
113
113
 
114
114
  # Email Action (this will render the appropriate view on GET requests and process the form and send the email on POST requests)
115
115
  def email
116
- @response, @documents = get_solr_response_for_field_values(SolrDocument.unique_key,params[:id])
116
+ @response, @documents = get_solr_response_for_document_ids(params[:id])
117
117
 
118
118
  if request.post? and validate_email_params
119
119
  email = RecordMailer.email_record(@documents, {:to => params[:to], :message => params[:message]}, url_options)
@@ -136,7 +136,7 @@ module Blacklight::Catalog
136
136
 
137
137
  # SMS action (this will render the appropriate view on GET requests and process the form and send the email on POST requests)
138
138
  def sms
139
- @response, @documents = get_solr_response_for_field_values(SolrDocument.unique_key,params[:id])
139
+ @response, @documents = get_solr_response_for_document_ids(params[:id])
140
140
 
141
141
  if request.post? and validate_sms_params
142
142
  to = "#{params[:to].gsub(/[^\d]/, '')}@#{sms_mappings[params[:carrier]]}"
@@ -170,6 +170,8 @@ module Blacklight::Catalog
170
170
  # non-routable methods ->
171
171
  #
172
172
 
173
+ ##
174
+ # Render additional response formats, as provided by the blacklight configuration
173
175
  def additional_response_formats format
174
176
  blacklight_config.index.respond_to.each do |key, config|
175
177
  format.send key do
@@ -189,6 +191,32 @@ module Blacklight::Catalog
189
191
  end
190
192
  end
191
193
 
194
+ ##
195
+ # Try to render a response from the document export formats available
196
+ def document_export_formats format
197
+ format.any do
198
+ format_name = params.fetch(:format, '').to_sym
199
+
200
+ if @response.export_formats.include? format_name
201
+ render_document_export_format format_name
202
+ else
203
+ raise ActionController::UnknownFormat.new
204
+ end
205
+ end
206
+ end
207
+
208
+ ##
209
+ # Render the document export formats for a response
210
+ # First, try to render an appropriate template (e.g. index.endnote.erb)
211
+ # If that fails, just concatenate the document export responses with a newline.
212
+ def render_document_export_format format_name
213
+ begin
214
+ render
215
+ rescue ActionView::MissingTemplate
216
+ render text: @response.documents.map { |x| x.export_as(format_name) if x.exports_as? format_name }.compact.join("\n"), layout: false
217
+ end
218
+ end
219
+
192
220
  # override this method to change the JSON response from #index
193
221
  def render_search_results_as_json
194
222
  {response: {docs: @document_list, facets: search_facets_as_json, pages: pagination_info(@response)}}
@@ -17,9 +17,8 @@ module Blacklight
17
17
  # the basic, required Blacklight fields
18
18
  class << self
19
19
  def default_values
20
- @default_values ||= begin
21
- unique_key = ((SolrDocument.unique_key if defined?(SolrDocument)) || 'id')
22
20
 
21
+ @default_values ||= begin
23
22
  {
24
23
  # HTTP method to use when making requests to solr; valid
25
24
  # values are :get and :post.
@@ -30,6 +29,8 @@ module Blacklight
30
29
  :solr_path => 'select',
31
30
  # Default values of parameters to send with every search request
32
31
  :default_solr_params => {},
32
+ # the model to load solr response documents into; set below in #initialize_default_values
33
+ :solr_document_model => nil,
33
34
  # The solr rqeuest handler to use when requesting only a single document
34
35
  :document_solr_request_handler => 'document',
35
36
  # THe path to send single document requests to solr
@@ -50,7 +51,7 @@ module Blacklight
50
51
  # General configuration for all views
51
52
  :index => ViewConfig::Index.new(
52
53
  # solr field to use to render a document title
53
- :title_field => unique_key,
54
+ :title_field => nil,
54
55
  # solr field to use to render format-specific partials
55
56
  :display_type_field => 'format',
56
57
  # partials to render for each document(see #render_document_partials)
@@ -131,6 +132,10 @@ module Blacklight
131
132
  self[k] ||= v
132
133
  end
133
134
  end
135
+
136
+ def solr_document_model
137
+ super || SolrDocument
138
+ end
134
139
 
135
140
  ##
136
141
  # DSL helper
@@ -160,6 +165,10 @@ module Blacklight
160
165
 
161
166
  field
162
167
  end
168
+
169
+ def default_title_field
170
+ solr_document_model.unique_key || 'id'
171
+ end
163
172
 
164
173
  ##
165
174
  # Add any configured facet fields to the default solr parameters hash