blacklight 3.8.2 → 4.0.0.pre6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (206) hide show
  1. data/Gemfile +1 -0
  2. data/README.md +1 -1
  3. data/VERSION +1 -1
  4. data/app/assets/javascripts/blacklight/blacklight.js +12 -1
  5. data/app/assets/javascripts/blacklight/bootstrap_dropdowns.js +3 -0
  6. data/app/assets/javascripts/blacklight/checkbox_submit.js +12 -5
  7. data/app/assets/javascripts/blacklight/core.js +0 -1
  8. data/app/assets/javascripts/blacklight/css_dropdowns.js +10 -0
  9. data/app/assets/javascripts/blacklight/facet_expand_contract.js +5 -5
  10. data/app/assets/javascripts/blacklight/lightbox_dialog.js +68 -13
  11. data/app/assets/javascripts/blacklight/select_submit.js +19 -10
  12. data/app/assets/javascripts/improved-modal/bootstrap-modal.js +282 -0
  13. data/app/assets/javascripts/improved-modal/bootstrap-modalmanager.js +353 -0
  14. data/app/assets/stylesheets/blacklight/_blacklight_base.css.scss +16 -5
  15. data/app/assets/stylesheets/blacklight/_bookmark.css.scss +24 -6
  16. data/app/assets/stylesheets/blacklight/_catalog.css.scss +115 -141
  17. data/app/assets/stylesheets/blacklight/_dropdown.css.scss +57 -0
  18. data/app/assets/stylesheets/blacklight/_facets.css.scss +127 -58
  19. data/app/assets/stylesheets/blacklight/_footer.css.scss +20 -0
  20. data/app/assets/stylesheets/blacklight/_header.css.scss +90 -21
  21. data/app/assets/stylesheets/blacklight/_layout.css.scss +10 -9
  22. data/app/assets/stylesheets/blacklight/_modal.css.scss +23 -0
  23. data/app/assets/stylesheets/blacklight/_print.css.scss +0 -7
  24. data/app/assets/stylesheets/blacklight/_responsive.css.scss +3 -0
  25. data/app/assets/stylesheets/blacklight/_search_history.css.scss +2 -4
  26. data/app/assets/stylesheets/blacklight/blacklight.css.scss +0 -1
  27. data/app/assets/stylesheets/blacklight/blacklight_defaults.css.scss +9 -2
  28. data/app/assets/stylesheets/blacklight/responsive_partials/_catalog.css.scss +5 -0
  29. data/app/assets/stylesheets/blacklight/responsive_partials/_facets.css.scss +37 -0
  30. data/app/assets/stylesheets/blacklight/responsive_partials/_header.css.scss +30 -0
  31. data/app/assets/stylesheets/improved-modal/bootstrap-modal.css +199 -0
  32. data/app/controllers/bookmarks_controller.rb +16 -10
  33. data/app/helpers/blacklight/blacklight_helper_behavior.rb +124 -61
  34. data/app/helpers/blacklight/catalog_helper_behavior.rb +5 -3
  35. data/app/helpers/blacklight/facets_helper_behavior.rb +9 -9
  36. data/app/views/_flash_msg.html.erb +9 -4
  37. data/app/views/_user_util_links.html.erb +23 -17
  38. data/app/views/bookmarks/_tools.html.erb +7 -7
  39. data/app/views/bookmarks/index.html.erb +5 -13
  40. data/app/views/catalog/_bookmark_control.html.erb +2 -4
  41. data/app/views/catalog/_bookmark_form.html.erb +1 -1
  42. data/app/views/catalog/_citation.html.erb +21 -20
  43. data/app/views/catalog/_constraints.html.erb +8 -6
  44. data/app/views/catalog/_document_header.html.erb +6 -7
  45. data/app/views/catalog/_document_list.html.erb +1 -7
  46. data/app/views/catalog/_email_form.html.erb +42 -16
  47. data/app/views/catalog/_facet_layout.html.erb +1 -1
  48. data/app/views/catalog/_facet_limit.html.erb +1 -1
  49. data/app/views/catalog/_facet_pagination.html.erb +11 -14
  50. data/app/views/catalog/_facets.html.erb +16 -2
  51. data/app/views/catalog/_home.html.erb +2 -2
  52. data/app/views/catalog/_home_text.html.erb +5 -2
  53. data/app/views/catalog/_index_default.html.erb +2 -2
  54. data/app/views/catalog/_marc_view.html.erb +0 -1
  55. data/app/views/catalog/_paginate_compact.html.erb +5 -0
  56. data/app/views/catalog/_per_page_widget.html.erb +13 -7
  57. data/app/views/catalog/_previous_next_doc.html.erb +14 -4
  58. data/app/views/catalog/_refworks_form.html.erb +2 -2
  59. data/app/views/catalog/_results_pagination.html.erb +4 -1
  60. data/app/views/catalog/_search_form.html.erb +19 -13
  61. data/app/views/catalog/_show_default.html.erb +2 -2
  62. data/app/views/catalog/_show_more_like_this.html.erb +3 -0
  63. data/app/views/catalog/_show_sidebar.html.erb +14 -1
  64. data/app/views/catalog/_show_tools.html.erb +18 -18
  65. data/app/views/catalog/_sms_form.html.erb +35 -10
  66. data/app/views/catalog/_sort_and_per_page.html.erb +5 -3
  67. data/app/views/catalog/_sort_widget.html.erb +12 -6
  68. data/app/views/catalog/citation.html.erb +1 -1
  69. data/app/views/catalog/citation.js.erb +7 -0
  70. data/app/views/catalog/email.html.erb +5 -0
  71. data/app/views/catalog/facet.html.erb +28 -21
  72. data/app/views/catalog/index.html.erb +26 -26
  73. data/app/views/catalog/librarian_view.html.erb +7 -0
  74. data/app/views/catalog/show.html.erb +35 -29
  75. data/app/views/catalog/sms.html.erb +5 -0
  76. data/app/views/kaminari/blacklight/_first_page.html.erb +2 -2
  77. data/app/views/kaminari/blacklight/_gap.html.erb +4 -1
  78. data/app/views/kaminari/blacklight/_last_page.html.erb +2 -2
  79. data/app/views/kaminari/blacklight/_next_page.html.erb +3 -3
  80. data/app/views/kaminari/blacklight/_page.html.erb +4 -3
  81. data/app/views/kaminari/blacklight/_paginator.html.erb +5 -5
  82. data/app/views/kaminari/blacklight/_prev_page.html.erb +3 -3
  83. data/app/views/kaminari/blacklight_compact/_next_page.html.erb +9 -0
  84. data/app/views/kaminari/blacklight_compact/_paginator.html.erb +15 -0
  85. data/app/views/kaminari/blacklight_compact/_prev_page.html.erb +9 -0
  86. data/app/views/layouts/blacklight.html.erb +47 -27
  87. data/app/views/saved_searches/index.html.erb +2 -2
  88. data/app/views/search_history/index.html.erb +12 -7
  89. data/app/views/shared/_footer.html.erb +0 -0
  90. data/app/views/shared/_header_navbar.html.erb +25 -0
  91. data/blacklight.gemspec +2 -5
  92. data/config/locales/blacklight.en.yml +23 -15
  93. data/lib/blacklight.rb +2 -2
  94. data/lib/blacklight/catalog.rb +36 -14
  95. data/lib/blacklight/configuration.rb +10 -2
  96. data/lib/blacklight/mash.rb +151 -0
  97. data/lib/blacklight/solr/document.rb +73 -11
  98. data/lib/blacklight/solr/document/extensions.rb +0 -8
  99. data/lib/blacklight/solr/document/marc_export.rb +7 -2
  100. data/lib/blacklight/solr/document/more_like_this.rb +5 -0
  101. data/lib/blacklight/solr_helper.rb +43 -18
  102. data/lib/blacklight/solr_response.rb +60 -0
  103. data/lib/blacklight/solr_response/facets.rb +58 -0
  104. data/lib/blacklight/solr_response/more_like_this.rb +14 -0
  105. data/lib/blacklight/solr_response/spelling.rb +92 -0
  106. data/lib/generators/blacklight/assets_generator.rb +1 -14
  107. data/lib/generators/blacklight/blacklight_generator.rb +22 -21
  108. data/lib/generators/blacklight/jetty_generator.rb +1 -35
  109. data/{test_support → lib/generators/blacklight/templates}/alternate_controller.rb +0 -0
  110. data/lib/generators/blacklight/templates/blacklight.css.scss +4 -0
  111. data/lib/generators/blacklight/templates/config/SolrMarc/config-test.properties +2 -2
  112. data/lib/generators/blacklight/templates/config/jetty.yml +6 -0
  113. data/lib/generators/blacklight/test_support_generator.rb +35 -0
  114. data/lib/railties/all_tests.rake +5 -23
  115. data/lib/railties/blacklight_cucumber.rake +2 -11
  116. data/lib/railties/blacklight_rspec.rake +2 -12
  117. data/test_support/bin/run-tests.sh +1 -1
  118. data/test_support/bin/setup-test-app.sh +123 -0
  119. data/test_support/bin/test.sh +21 -21
  120. data/test_support/features/bookmarks.feature +9 -3
  121. data/test_support/features/saved_searches.feature +3 -3
  122. data/test_support/features/search.feature +3 -3
  123. data/test_support/features/search_filters.feature +24 -26
  124. data/test_support/features/search_history.feature +9 -10
  125. data/test_support/features/search_sort.feature +4 -6
  126. data/test_support/features/step_definitions/general_steps.rb +0 -4
  127. data/test_support/features/step_definitions/search_result_steps.rb +2 -1
  128. data/test_support/features/step_definitions/search_steps.rb +32 -2
  129. data/test_support/spec/controllers/application_controller_spec.rb +8 -0
  130. data/test_support/spec/controllers/catalog_controller_spec.rb +3 -18
  131. data/test_support/spec/helpers/blacklight_helper_spec.rb +116 -20
  132. data/test_support/spec/helpers/catalog_helper_spec.rb +14 -6
  133. data/test_support/spec/helpers/facets_helper_spec.rb +1 -1
  134. data/test_support/spec/lib/blacklight_solr_document_more_like_this_spec.rb +18 -0
  135. data/test_support/spec/lib/blacklight_solr_document_spec.rb +54 -1
  136. data/test_support/spec/lib/blacklight_solr_response_spec.rb +153 -0
  137. data/test_support/spec/lib/facet_paginator_spec.rb +1 -1
  138. data/test_support/spec/lib/marc_export_spec.rb +14 -6
  139. data/test_support/spec/lib/solr_helper_spec.rb +22 -6
  140. data/test_support/spec/models/solr_docment_spec.rb +1 -4
  141. data/test_support/spec/{features → requests}/alternate_controller_spec.rb +3 -2
  142. data/test_support/spec/views/catalog/_facets.html.erb_spec.rb +20 -4
  143. data/test_support/spec/views/catalog/_show_sidebar.erb_spec.rb +25 -0
  144. metadata +53 -131
  145. data/app/assets/javascripts/blacklight/more_facets.js +0 -16
  146. data/app/assets/javascripts/jquery-1.4.2.min.js +0 -154
  147. data/app/assets/javascripts/jquery-ui-1.8.1.custom.min.js +0 -756
  148. data/app/assets/javascripts/jquery.uiExt.ajaxyDialog.js +0 -180
  149. data/app/assets/stylesheets/blacklight/_formatting.css.scss +0 -164
  150. data/app/assets/stylesheets/blacklight/grids/_susy_grid.css.scss +0 -72
  151. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-anim_basic_16x16.gif +0 -0
  152. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  153. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  154. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
  155. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  156. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  157. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  158. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_gloss-wave_35_558fd0_500x100.png +0 -0
  159. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  160. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  161. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
  162. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
  163. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-icons_2e4f81_256x240.png +0 -0
  164. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
  165. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
  166. data/app/assets/stylesheets/jquery/ui-lightness/jquery-ui-1.8.1.custom.css +0 -486
  167. data/app/models/solr_document.rb +0 -5
  168. data/app/views/catalog/email.erb +0 -1
  169. data/app/views/catalog/sms.erb +0 -1
  170. data/doc/Atom-Responses.md +0 -90
  171. data/doc/Blacklight-3.2-Release-Notes-and-Upgrade-Guide.md +0 -191
  172. data/doc/Blacklight-3.3-release-notes-and-upgrade-guide.md +0 -37
  173. data/doc/Blacklight-3.4-release-notes-and-upgrade-guide.md +0 -27
  174. data/doc/Blacklight-3.5-release-notes-and-upgrade-guide.md +0 -44
  175. data/doc/Blacklight-3.6-release-notes-and-upgrade-guide.md +0 -25
  176. data/doc/Blacklight-3.7-release-notes-and-upgrade-guide.md +0 -78
  177. data/doc/Blacklight-3.8-release-notes-and-upgrade-guide.md +0 -11
  178. data/doc/Blacklight-Add-ons.md +0 -28
  179. data/doc/Blacklight-configuration.md +0 -301
  180. data/doc/Blacklight-on-Heroku.md +0 -135
  181. data/doc/Community-principles.md +0 -44
  182. data/doc/Configuring-and-Customizing-Blacklight.md +0 -271
  183. data/doc/Contributing-to-Blacklight.md +0 -25
  184. data/doc/Examples.md +0 -62
  185. data/doc/Extending-or-Modifying-Blacklight-Search-Behavior.md +0 -141
  186. data/doc/Home.md +0 -77
  187. data/doc/How-to-release-a-version.md +0 -37
  188. data/doc/Indexing-your-data-into-solr.md +0 -5
  189. data/doc/Integration-with-Rails-Footnotes.md +0 -20
  190. data/doc/Pagination.md +0 -38
  191. data/doc/Providing-your-own-view-templates.md +0 -109
  192. data/doc/Quickstart.md +0 -116
  193. data/doc/README.md +0 -77
  194. data/doc/README_SOLR.md +0 -245
  195. data/doc/Release-Notes-And-Upgrade-Guides.md +0 -14
  196. data/doc/Sunspot-for-indexing.md +0 -46
  197. data/doc/User-Authentication.md +0 -60
  198. data/doc/testing.md +0 -115
  199. data/lib/generators/blacklight/solr_conf_generator.rb +0 -26
  200. data/lib/generators/blacklight/templates/assets/standard.css.scss +0 -59
  201. data/lib/generators/blacklight/templates/config/blacklight_config.rb +0 -3
  202. data/lib/generators/blacklight/templates/config/compass.rb +0 -2
  203. data/lib/generators/blacklight/templates/solr_conf/schema.xml +0 -689
  204. data/lib/generators/blacklight/templates/solr_conf/solrconfig.xml +0 -1846
  205. data/lib/solrmarc.log.1 +0 -849
  206. data/test_support/spec/controllers/bookmarks_controller_spec.rb +0 -48
@@ -1,11 +0,0 @@
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]]
@@ -1,28 +0,0 @@
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
@@ -1,301 +0,0 @@
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
- ```
@@ -1,135 +0,0 @@
1
- Blacklight can be deployed on [Heroku](http://heroku.com/), a Platform-as-a-Service (PaaS) provider that supports Ruby. This walkthrough assumes some familiarity with Heroku, that you have a Solr server running somewhere, and that you already have a Heroku account. For more information on working with Heroku, please see [Getting Started with Heroku](https://devcenter.heroku.com/articles/quickstart).
2
-
3
- ## Create a new Blacklight app
4
-
5
- * Use the Blacklight [[Quickstart]] to create a new Rails application:
6
-
7
- ```bash
8
- $ rails new blheroku
9
- # create
10
- # create README
11
- # create Rakefile
12
- # create config.ru
13
- # create .gitignore
14
- # create Gemfile
15
- # [...]
16
-
17
- $ cd blheroku
18
- $ rm public/index.html
19
-
20
- * Append this line to your application's `Gemfile`:
21
-
22
- ```ruby
23
- gem 'blacklight'
24
- ```
25
-
26
- * Install the gems using Bundler:
27
-
28
- ```bash
29
- $ bundle install
30
- ```
31
-
32
- * Call the Blacklight generator (in this case, without Devise for authentication):
33
-
34
- ```bash
35
- $ rails generate blacklight
36
- ```
37
-
38
- ## Change Gem dependencies for Heroku deployment
39
-
40
- * Change the database-related gems in your `Gemfile` from:
41
-
42
- ```ruby
43
- gem 'sqlite3'
44
- ```
45
-
46
- * to the following:
47
-
48
- ```ruby
49
- gem 'sqlite3', :groups => [:development, :test]
50
- gem 'pg', :group => :production
51
- ```
52
-
53
- * Move all gems in the asset block of `Gemfile` to the main block [see here for more info](http://stackoverflow.com/questions/9629620), changing from:
54
-
55
- ```ruby
56
- # Gems used only for assets and not required
57
- # in production environments by default.
58
- group :assets do
59
- gem 'sass-rails', '~> 3.2.3'
60
- gem 'coffee-rails', '~> 3.2.1'
61
-
62
- # See https://github.com/sstephenson/execjs#readme for more supported runtimes
63
- # gem 'therubyracer'
64
-
65
- gem 'uglifier', '>= 1.0.3'
66
- end
67
-
68
- # ... probably at the bottom from here on out
69
-
70
- gem "compass-rails", "~> 1.0.0", :group => :assets
71
- gem "compass-susy-plugin", "~> 0.9.0", :group => :assets
72
- ```
73
-
74
- * to the following:
75
-
76
- ```ruby
77
- # Gems used only for assets and not required
78
- # in production environments by default.
79
- gem 'sass-rails', '~> 3.2.3'
80
- gem 'coffee-rails', '~> 3.2.1'
81
-
82
- # See https://github.com/sstephenson/execjs#readme for more supported runtimes
83
- # gem 'therubyracer'
84
-
85
- gem 'uglifier', '>= 1.0.3'
86
-
87
- # ... probably at the bottom from here on out
88
-
89
- gem "compass-rails", "~> 1.0.0"
90
- gem "compass-susy-plugin", "~> 0.9.0"
91
- ```
92
-
93
-
94
- ## Configure Solr for your application
95
-
96
- * While untested, you may want to look at [Websolr](http://websolr.com/), which provides Solr as a Service.
97
- * Add a line `config/solr.yml` to point to your production instance of Solr:
98
-
99
- ```yaml
100
- production:
101
- url: http://my.solr.host:8983/path/to/solr
102
- ```
103
-
104
- ## Index some test records
105
-
106
- ```bash
107
- $ RAILS_ENV=production rake solr:marc:index_test_data
108
- ```
109
- ## Set up Heroku
110
-
111
- ```bash
112
- $ git init
113
- $ heroku create --stack cedar
114
- Creating vivid-winter-2427... done, stack is cedar
115
- http://vivid-winter-2427.herokuapp.com/ | git@heroku.com:vivid-winter-2427.git
116
- Git remote heroku added
117
- $ git add .
118
- $ git commit -m"Initial import"
119
- ```
120
-
121
- * Take note of the URL reported back by Heroku (in this case, http://vivid-winter-2427.herokuapp.com/)
122
-
123
- ## Deploy to Heroku
124
-
125
- ```bash
126
- $ git push heroku master
127
- [...]
128
- $ heroku run rake db:migrate
129
- [...]
130
- ```
131
-
132
- ## Try opening up your app
133
-
134
- * Go to URL reported by Heroku above (in this example, http://vivid-winter-2427.herokuapp.com/).
135
- * Does it work? If it doesn't, try running `heroku logs` to see where problems are cropping up.