blacklight 3.8.1 → 3.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/.travis.yml +14 -0
  2. data/VERSION +1 -1
  3. data/app/controllers/bookmarks_controller.rb +2 -0
  4. data/app/models/solr_document.rb +5 -0
  5. data/app/views/_user_util_links.html.erb +2 -0
  6. data/app/views/catalog/_bookmark_control.html.erb +1 -1
  7. data/doc/Atom-Responses.md +90 -0
  8. data/doc/Blacklight-3.2-Release-Notes-and-Upgrade-Guide.md +191 -0
  9. data/doc/Blacklight-3.3-release-notes-and-upgrade-guide.md +37 -0
  10. data/doc/Blacklight-3.4-release-notes-and-upgrade-guide.md +27 -0
  11. data/doc/Blacklight-3.5-release-notes-and-upgrade-guide.md +44 -0
  12. data/doc/Blacklight-3.6-release-notes-and-upgrade-guide.md +25 -0
  13. data/doc/Blacklight-3.7-release-notes-and-upgrade-guide.md +78 -0
  14. data/doc/Blacklight-3.8-release-notes-and-upgrade-guide.md +11 -0
  15. data/doc/Blacklight-Add-ons.md +28 -0
  16. data/doc/Blacklight-configuration.md +301 -0
  17. data/doc/Blacklight-on-Heroku.md +135 -0
  18. data/doc/Community-principles.md +44 -0
  19. data/doc/Configuring-and-Customizing-Blacklight.md +271 -0
  20. data/doc/Contributing-to-Blacklight.md +25 -0
  21. data/doc/Examples.md +62 -0
  22. data/doc/Extending-or-Modifying-Blacklight-Search-Behavior.md +141 -0
  23. data/doc/Home.md +77 -0
  24. data/doc/How-to-release-a-version.md +37 -0
  25. data/doc/Indexing-your-data-into-solr.md +5 -0
  26. data/doc/Integration-with-Rails-Footnotes.md +20 -0
  27. data/doc/Pagination.md +38 -0
  28. data/doc/Providing-your-own-view-templates.md +109 -0
  29. data/doc/Quickstart.md +116 -0
  30. data/doc/README.md +77 -0
  31. data/doc/README_SOLR.md +245 -0
  32. data/doc/Release-Notes-And-Upgrade-Guides.md +14 -0
  33. data/doc/Sunspot-for-indexing.md +46 -0
  34. data/doc/User-Authentication.md +60 -0
  35. data/doc/testing.md +115 -0
  36. data/lib/blacklight/controller.rb +4 -1
  37. data/lib/generators/blacklight/blacklight_generator.rb +2 -1
  38. data/lib/solrmarc.log.1 +849 -0
  39. data/test_support/bin/test.sh +3 -1
  40. data/test_support/features/record_view.feature +0 -1
  41. data/test_support/features/search.feature +0 -1
  42. data/test_support/features/step_definitions/error_steps.rb +1 -1
  43. data/test_support/features/step_definitions/general_steps.rb +1 -1
  44. data/test_support/features/step_definitions/search_facets_steps.rb +7 -7
  45. data/test_support/features/step_definitions/search_steps.rb +2 -2
  46. data/test_support/spec/{requests → features}/alternate_controller_spec.rb +0 -0
  47. data/test_support/spec/helpers/blacklight_helper_spec.rb +5 -5
  48. metadata +37 -5
@@ -0,0 +1,25 @@
1
+ # Blacklight 3.6 Release Notes And Upgrade Guide
2
+
3
+ ## Release Notes
4
+ # Blacklight 3.6 Release notes
5
+ Blacklight 3.6.0 is now available. This is mostly a collection of small patches.
6
+
7
+
8
+ - Fix blacklight to be compatible with newly released version of Kaminari
9
+ - Split document_header into its own partial
10
+ - Utilizing rails own capability to determine partial paths for collections
11
+ - #423 using response.total instead of the underlying hash
12
+ - many more
13
+
14
+
15
+ The full list of Github issues are at:
16
+ https://github.com/projectblacklight/blacklight/issues?milestone=8&state=closed
17
+
18
+ Also, the GitHub compare view of this release vs. our last release is
19
+ located at:
20
+ https://github.com/projectblacklight/blacklight/compare/release-3.5...release-3.6
21
+
22
+
23
+ ## Upgrade Guide
24
+
25
+ No known issues updating from 3.5 to 3.6. If you are overriding app/views/catalog/_document_list.html.erb in your local application, you may want to look at how it is now written in the gem. See https://github.com/projectblacklight/blacklight/commit/b712d79fa88e80155972ce3e9bc7629d7e63c1eb
@@ -0,0 +1,78 @@
1
+ ## Bookmarks and Folders merged
2
+
3
+ When upgrading to Blacklight 3.7, if you want to keep the 'folders' feature (of session-based, anonymous item selection), you should add this gem to your Gemfile:
4
+
5
+ ```
6
+ gem 'devise-guests'
7
+ ```
8
+
9
+ The bookmarks (database persisted, user-based) and folders (session stored, session-based) features have been merged into a single bookmarks feature (database persisted, user-based). These bookmarks are database-persisted and assume an ActiveRecord-based user model.
10
+
11
+ The [devise-guests](http://rubygems.org/gems/devise-guests), generated into new applications by default, provides (session-based) guest user functionality to Devise (and, to Blacklight for applications that are using Devise). When a guest user logs in, the bookmarks associated with the guest user are transfered to the logged in user.
12
+
13
+ ### Implementation details for those not using devise.
14
+
15
+ We've added a new method ```#current_or_guest_user```. By default, this is just the value of ```#current_user``` (provided by Devise, or whatever authentication layer you are using). Applications that want to provide session-based bookmarks should implement ```#current_or_guest_user``` and ``#guest_user``` in the application and return the current user (when logged in) or a session-based guest user record.
16
+
17
+ When a user logs in, your application should call ```#transfer_guest_user_actions_to_current_user``` to move the bookmarks and saved searches to the logged in user.
18
+
19
+ ## Query Facets
20
+
21
+ Blacklight 3.7 adds support for Solr query facets. There's an example of this in the [Blacklight demo](http://demo.projectblacklight.org) with the Publish Date facet.
22
+
23
+ The Publish Date facet is using this configuration:
24
+
25
+ ```ruby
26
+ config.add_facet_field 'example_query_facet_field', :label => 'Publish Date', :query => {
27
+ :years_5 => { :label => 'within 5 Years', :fq => "pub_date:[#{Time.now.year - 5 } TO *]" },
28
+ :years_10 => { :label => 'within 10 Years', :fq => "pub_date:[#{Time.now.year - 10 } TO *]" },
29
+ :years_25 => { :label => 'within 25 Years', :fq => "pub_date:[#{Time.now.year - 25 } TO *]" }
30
+ }
31
+ ```
32
+
33
+ The first argument (which maps to the facet field for plain facets) is used in the Blacklight URL when the facet is selected.
34
+
35
+ The ```:query``` hash maps the URL key into a facet label (to show to the user) and a fq to send to `facet.query` and, after selection, the Solr `fq` parameter.
36
+
37
+
38
+ ### A small change to the Blacklight configuration to get Blacklight to generate facet.query for you.
39
+
40
+ In older versions of Blacklight, the facet field keys mapped directly to the Solr ```facet.field``` parameter. By default, Blacklight generated the following into your CatalogController configuration:
41
+
42
+ ```
43
+ config.default_solr_params[:'facet.field'] = config.facet_fields.keys
44
+ ```
45
+
46
+ In the new model, this logic is deferred as part of the Blacklight solr search params logic. The above line should be replaced with:
47
+
48
+ ```
49
+ # Have BL send all facet field names to Solr, which has been the default
50
+ # previously. Simply remove these lines if you'd rather use Solr request
51
+ # handler defaults, or have no facets.
52
+ config.add_facet_fields_to_solr_request!
53
+ ```
54
+
55
+ This will add the plain facets to the ```facet.field``` and the query facets to the ```facet.query```.
56
+
57
+ ### Adding facet queries to the solr request handler yourself
58
+
59
+ If you want to add the facet queries directly to your solr request handler, you should ensure the configuration for the Blacklight facet queries ```fq``` field matches a Solr ```facet.query``` field.
60
+
61
+ So, given this Solr response:
62
+
63
+ ```xml
64
+ <lst name="facet_counts">
65
+ <lst name="facet_queries">
66
+ <int name="lc_alpha_facet:A">0</int>
67
+ </lst>
68
+ ...
69
+ </lst>
70
+ ```
71
+
72
+ The Blacklight-side config would look something like:
73
+
74
+ ```ruby
75
+ config.add_facet_field 'contrived_blacklight_configuration_example', :query => {
76
+ :a => { :label => 'starting with A', :fq => "lc_alpha_facet:A" },
77
+ }
78
+ ```
@@ -0,0 +1,11 @@
1
+ This is primarily a release to bring the Blacklight 3.x line up to feature-parity with the upcoming bootstrap release, and contains backports of features and bugfixes from the bootstrap work.
2
+
3
+ Highlights include:
4
+
5
+ - pulling bookmark data from solr (rather than a database-backed title cache)
6
+ - clean-up of some pagination code
7
+ - pruning dead code around folders (removed in the 3.7 release)
8
+
9
+ And more:
10
+
11
+ [[https://github.com/projectblacklight/blacklight/compare/v3.7.2...v3.8.0]]
@@ -0,0 +1,28 @@
1
+ ## Stable Add-ons
2
+
3
+ A few add-ons are are more or less 'officially supported', and all Blacklight developers have commit rights on them. (although some may not have received attention in a while if developers have been busy. Feel free to ask on the list for current status):
4
+
5
+ * [Advanced search](https://github.com/projectblacklight/blacklight_advanced_search) plugin
6
+ * [CQL search](https://github.com/projectblacklight/blacklight_cql) plugin
7
+ * a fancy GUI [date range limit](https://github.com/projectblacklight/blacklight_range_limit) plugin.
8
+
9
+
10
+
11
+ [RSolr Footnotes](https://github.com/cbeer/rsolr-footnotes) is useful for debugging, to see the request/response sent to Solr via RSolr: [[Integration with Rails Footnotes]]
12
+
13
+ (Not all 'stable' add-ons neccesarily need to be in Blacklight github areas; if others come to exist that the community deems stable, feel free to add them here.)
14
+
15
+
16
+ ## Unstable/Experimental
17
+
18
+ * [[Blacklight Sitemap Generator|https://github.com/jronallo/blacklight-sitemap]]: Rake task for generating sitemaps.
19
+ * [[Blacklight Highlight|https://github.com/cbeer/blacklight_highlight]]: Expose Solr fulltext highlighting.
20
+ * [[Blacklight OAI provider|https://github.com/cbeer/blacklight_oai_provider]]: Adds an [[OAI-PMH|http://www.openarchives.org/pmh/]] provider using the [[oai|http://rubygems.org/gems/oai]] gem for harvesting records within Blacklight.
21
+ * [[Blacklight unAPI|https://github.com/cbeer/blacklight_unapi]]: Adds an [[unAPI|http://unapi.info]] endpoint for records within Blacklight.
22
+ * [[Blacklight User Generated Content|https://github.com/cbeer/blacklight_user_generated_content]]: Adds user generated content to SolrDocument objects using acts_as_commentable, acts_as_taggable and acts_as_rateable directly against a SolrDocument object.
23
+ * [[Blacklight oEmbed|https://github.com/cbeer/blacklight_oembed]]: [[oEmbed|http://oembed.com]] endpoint that provides framework for allowing third-party sites (Wordpress, Facebook, etc) to embed content given a URL.
24
+ * [[Blacklight More Like This|https://github.com/cbeer/blacklight_mlt]]: Solr more like this results
25
+ * [[Blacklight Google Analytics|https://github.com/jronallo/blacklight_google_analytics]]: Quick start for setting up Google Analytics for a Blacklight site, including Event Tracking of Blacklight-specific page elements like facets.
26
+
27
+ # Deprecated
28
+ * [[Blacklight Facet Extras|https://github.com/cbeer/blacklight_facet_extras]]: Exposes new faceting features present in Solr 3.1 and 3.4, such as facet queries, facet range requests, pivot facets, and tagged/excluded facets
@@ -0,0 +1,301 @@
1
+ # Configuring Blacklight to work with your Solr index
2
+
3
+ In order to fully understand this section, you should be familiar with Solr, ways to index data into Solr, how to configure request handlers, and how to change a Solr schema. Those topics are covered in the official [Apache Solr Tutorial](http://lucene.apache.org/solr/tutorial.html).
4
+
5
+ The Blacklight example configuration is a (simplified) way to work with library data (in the MARC format), it is (hopefully) easy to reconfigure to work with your Solr index. In this section, we will describe most of the Blacklight configuration settings that determine how the Blacklight interface works with your data. Later sections demonstrate how to modify the Blacklight user experience and templates, etc.
6
+
7
+ > Note: In most of this section, we will show how to configure Blacklight to request data from Solr. While this works, and makes it easy to rapidly develop an application, we recommend eventually configuring your Apache Solr request handlers to do this instead.
8
+
9
+
10
+ ## Connecting to Solr: config/solr.xml
11
+
12
+ Your Blacklight-based application will interact with your Solr index. Although Blacklight does distribute a sample jetty-based Solr instance, you will likely want to connect Blacklight to your own Solr index. The Solr index to use is specified in a configuration file, ```config/solr.yml```. If you open this file in a recently generated Blacklight application, you’ll see a default solr configured to use a single-core Solr running under jetty:
13
+
14
+ ```yaml
15
+ development:
16
+ url: http://127.0.0.1:8983/solr
17
+
18
+ test:
19
+ url: http://127.0.0.1:8888/solr
20
+ ```
21
+
22
+ When you run your Rails application in the ```development``` environment, it will try to connect to Solr at ```http://127.0.0.1:8983/solr```, and, likewise, in ```test```, it will try to connect to Solr at ```http://127.0.0.1:8888/solr```.
23
+
24
+ This URL should point to the base path of your Solr application, and includes e.g. Solr core names (see below), but not request handler paths, etc.
25
+
26
+ Blacklight uses the RSolr gem to talk to Solr. The parameters are passed to [RSolr.connect](http://rubydoc.info/gems/rsolr/1.0.6/RSolr.connect).
27
+
28
+ ### Using Blacklight with a Multicore Solr
29
+
30
+ Here's an example of using a Multi-core Solr install with Blacklight:
31
+
32
+ ```yaml
33
+ development:
34
+ url: http://127.0.0.1:8983/solr/development-core
35
+ test:
36
+ url: http://127.0.0.1:8983/solr/test-core
37
+ ```
38
+
39
+ > TODO: Wouldn't it be nice if Blacklight provided a Rake task to check if Solr was up and working?
40
+
41
+ ## Blacklight Configuration
42
+
43
+ Now that you've connected to Solr, you probably want to configure Blacklight to display your Solr fields in the search results and facets, and also use your fields for search fields, sort options. This configuration goes in your CatalogController. By convention, this is in your Rails application, and is located at [```app/controllers/catalog_controller.rb```](https://github.com/projectblacklight/blacklight/blob/master/lib/generators/blacklight/templates/catalog_controller.rb).
44
+
45
+ The CatalogController includes functionality and templates for searching and displaying documents. The CatalogController needs to be configured so it knows about your Solr fields.
46
+
47
+ > NOTE: While most applications use only a single controller for search, it is possible to have multiple controllers with different configurations. This documentation will only discuss the simple case.
48
+
49
+ ### default_solr_params
50
+
51
+ The default_solr_params are parameters that will be sent to the Solr API on all search-like requests:
52
+
53
+ ```ruby
54
+ config.default_solr_params = {
55
+ :qt => 'search',
56
+ :rows => 10
57
+ }
58
+ ```
59
+
60
+ This configuration would send the following for any request to solr:
61
+
62
+ ```
63
+ http://localhost:8983/solr/select?qt=search&rows=10
64
+ ```
65
+
66
+ While the default_solr_params are useful for rapid development, they are often moved into the Solr request handler for production deployments.
67
+
68
+ A counter-part to default_solr_params is default_document_solr_params, which is sent when requesting only a single document from solr. In the Blacklight example solrconfig.xml, there is a `document` requestHandler to retrieve a single document at a time. We encourage you to adopt pattern as well, but with an existing Solr installation adding a single document requestHandler may not be an option. Instead, you can modify the `default_document_solr_params` to configure the appropriate defaults:
69
+
70
+ ```ruby
71
+ # See SolrHelper#solr_doc_params
72
+ config.default_document_solr_params = {
73
+ :qt => 'document',
74
+ ## These are hard-coded in the blacklight 'document' requestHandler
75
+ # :fl => '*',
76
+ # :rows => 1
77
+ # :q => '{!raw f=id v=$id}'
78
+ }
79
+ ```
80
+
81
+ Blacklight will add a query parameter called `id` containing the unique key for your document. It can be referenced as a Solr local parameter (as above) in your queries.
82
+
83
+
84
+ ### results views (index and show)
85
+
86
+
87
+ You can configure the fields and labels that are display for search results on the search and document views.
88
+
89
+ > Note: these must be STORED fields in the Solr index, and must be returned in the solr response or they will not be displayed.
90
+
91
+ There's a set of configuration parameters for the title and Blacklight template handling (discussed elsewhere):
92
+
93
+ ```ruby
94
+ # solr field configuration for search results/index views
95
+ config.index.show_link = 'title_display'
96
+ config.index.record_display_type = 'format'
97
+
98
+ # solr field configuration for document/show views
99
+ config.show.html_title = 'title_display'
100
+ config.show.heading = 'title_display'
101
+ config.show.display_type = 'format'
102
+ ```
103
+
104
+ This configuration will use the ```title_display``` Solr field as the link text for each document.
105
+
106
+ There's a separate section for the additional fields to display:
107
+
108
+ ```ruby
109
+ # [from app/controllers/catalog_controller.rb]
110
+ # solr fields to be displayed in the index (search results) view
111
+ # The ordering of the field names is the order of the display
112
+ config.add_index_field 'title_display', :label => 'Title:'
113
+ config.add_index_field 'title_vern_display', :label => 'Title:'
114
+ config.add_index_field 'author_display', :label => 'Author:'
115
+ config.add_index_field 'author_vern_display', :label => 'Author:'
116
+
117
+ # ...
118
+ # And likewise for the show (single-document) view:
119
+
120
+ config.add_show_field 'title_display', :label => 'Title:'
121
+ config.add_show_field 'title_vern_display', :label => 'Title:'
122
+ config.add_show_field 'subtitle_display', :label => 'Subtitle:'
123
+ ```
124
+
125
+ #### Using a helper method to render the value
126
+
127
+ You can use view helpers to render the Solr values, e.g.:
128
+
129
+ ```ruby
130
+ config.add_index_field 'title_vern_display', :label => 'Title:', :helper_method => :my_helper_method
131
+ ```
132
+
133
+ When Blacklight goes to display the 'title_vern_display' field, it will call ```my_helper_method``` to get the value to display. You can implement any logic you want to manipulate the solr document to return the value to display.
134
+
135
+ ```ruby
136
+ module ApplicationHelper
137
+ def my_helper_method args
138
+ args[:document][args[:field]].upcase
139
+ end
140
+ end
141
+ ```
142
+
143
+ Your helper method receives hash with (at least) two parameters:
144
+
145
+ - :document => the SolrDocument object
146
+ - :field => the solr field to display
147
+
148
+
149
+ #### Solr hit highlighting
150
+
151
+ You can trigger automatic Solr hit highlighting of results:
152
+
153
+ ```ruby
154
+ config.add_index_field 'title_vern_display', :label => 'Title:', :highlight => true
155
+ ```
156
+
157
+ This will cause Blacklight to look at the Solr highlight component response for the value of this field. This assumes you've configured the highlighting component elsewhere. The [Solr Highlighting Parameters](http://wiki.apache.org/solr/HighlightingParameters) documentation discusses the Solr parameters available to you. You could add these to your default_solr_params, request handler configuration, or elsewhere.
158
+
159
+ You can have Blacklight send the most basic highlighting parameters for you, if you set:
160
+
161
+ ```ruby
162
+ config.add_field_configuration_to_solr_request!
163
+ ```
164
+
165
+ This will enable the highlighting component and send 'hl.fl' parameters for the fields you wanted highlighted, but you will likely want to tweak this behavior further.
166
+
167
+ ### facet fields
168
+
169
+ Faceted search allows users to constrain searches by controlled vocabulary items
170
+ [[https://github.com/projectblacklight/projectblacklight.github.com/raw/master/images/search_facets.png|frame|alt=Search facets in action]]
171
+ Note that these must be INDEXED fields in the Solr index, and are generally a single token (e.g. a string).
172
+
173
+ ```ruby
174
+ # [from app/controllers/catalog_controller.rb]
175
+ # solr fields that will be treated as facets by the blacklight application
176
+ # The ordering of the field names is the order of the display
177
+ config.add_facet_field 'format', :label => 'Format'
178
+ config.add_facet_field 'pub_date', :label => 'Publication Year'
179
+ config.add_facet_field 'subject_topic_facet', :label => 'Topic', :limit => 20
180
+ config.add_facet_field 'language_facet', :label => 'Language', :limit => true
181
+ ```
182
+
183
+ ### Facet Queries
184
+ Blacklight also supports Solr facet queries:
185
+
186
+ ```ruby
187
+ config.add_facet_field 'pub_date_query', :label => 'Publication Year', :query => {
188
+ :last_5_years => { :label => 'Last 5 Years', :fq => "[#{Time.now.year-5} TO *]"}
189
+ }
190
+ ```
191
+
192
+ The first argument (which maps to the facet field for plain facets) is used in the Blacklight URL when the facet is selected.
193
+
194
+ The :query hash maps the a key to use in Blacklight URLs to a facet :label (used in the facet display) and an :fq to send to Solr as the `facet.query` and (if selected) the Solr `fq` parameter.
195
+
196
+ You can also tell Solr how to sort facets (either by count or index):
197
+ Note: setting 'index' causes Blacklight to sort by count and then by index. If your data is strings, you can use this to perform an alphabetical sort of the facets.
198
+ ```ruby
199
+ config.add_facet_field :my_count_sorted_field, :sort => 'count'
200
+ config.add_facet_field :my_index_sorted_field, :sort => 'index'
201
+ ```
202
+
203
+
204
+ If you want Solr to add the configured facets and facet queries to the Solr query it sends, you should also add:
205
+
206
+ ```ruby
207
+ config.add_facet_fields_to_solr_request!
208
+ ```
209
+
210
+ ### Date-based facets
211
+
212
+ If you have date facets in Solr, you should add a hint to the Blacklight configuration:
213
+
214
+ ```ruby
215
+ config.add_facet_field :my_date_field, :date => true
216
+ ```
217
+
218
+ This will trigger special date querying logic, and also use a localized date format when displaying the facet value. If you want to use a particular localization format, you can provide that as well:
219
+
220
+ ```ruby
221
+ config.add_facet_field :my_date_field, :date => { :format => :short }
222
+ ```
223
+
224
+ ### search fields
225
+
226
+ Search queries can be targeted at configurable fields (or sets of fields) to return precise search results. Advanced search capabilities are provided through the [[Advanced Search Add-On|https://github.com/projectblacklight/blacklight_advanced_search]]
227
+ [[https://github.com/projectblacklight/projectblacklight.github.com/raw/master/images/search_fields.png|frame|alt=Search fields in action]]
228
+
229
+ ```ruby
230
+ # [from app/controllers/catalog_controller.rb]
231
+ # Now we see how to over-ride Solr request handler defaults, in this
232
+ # case for a BL "search field", which is really a dismax aggregate
233
+ # of Solr search fields.
234
+
235
+ config.add_search_field('title') do |field|
236
+ # solr_parameters hash are sent to Solr as ordinary url query params.
237
+ field.solr_parameters = { :'spellcheck.dictionary' => 'title' }
238
+
239
+ # :solr_local_parameters will be sent using Solr LocalParams
240
+ # syntax, as eg {! qf=$title_qf }. This is neccesary to use
241
+ # Solr parameter de-referencing like $title_qf.
242
+ # See: http://wiki.apache.org/solr/LocalParams
243
+ field.solr_local_parameters = {
244
+ :qf => '$title_qf',
245
+ :pf => '$title_pf'
246
+ }
247
+ end
248
+ ```
249
+
250
+ ### sort fields
251
+
252
+ ```ruby
253
+ config.add_sort_field 'score desc, pub_date_sort desc, title_sort asc', :label => 'relevance'
254
+ config.add_sort_field 'pub_date_sort desc, title_sort asc', :label => 'year'
255
+ config.add_sort_field 'author_sort asc, title_sort asc', :label => 'author'
256
+ config.add_sort_field 'title_sort asc, pub_date_sort desc', :label => 'title'
257
+ ```
258
+
259
+ > TODO
260
+
261
+ ## Solr Document
262
+
263
+
264
+ By default, Blacklight assumes the unique key field in your solr index is called `id`. You can change this by editing `app/models/solr_document.rb`:
265
+
266
+ ```ruby
267
+ class SolrDocument
268
+ include Blacklight::Solr::Document
269
+
270
+ # self.unique_key = 'id'
271
+ ...
272
+ end
273
+ ```
274
+
275
+ If, for instance, your unique key field was 'uuid_s', this would read:
276
+
277
+ ```ruby
278
+ class SolrDocument
279
+ include Blacklight::Solr::Document
280
+
281
+ self.unique_key = 'uuid_s'
282
+ ...
283
+ end
284
+ ```
285
+
286
+ This will instruct Blacklight to use your ```uuid_s``` field any time it needs an identifier for the document, e.g. when constructing document URLs.
287
+
288
+ lso in SolrDocument is a set of "field semantics", which may be used in some basic metadata mapping:
289
+
290
+ ```ruby
291
+ class SolrDocument
292
+ ...
293
+
294
+ field_semantics.merge!(
295
+ :title => "title_display",
296
+ :author => "author_display",
297
+ :language => "language_facet",
298
+ :format => "format"
299
+ )
300
+ end
301
+ ```