blacklight 4.9.0 → 5.0.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.travis.yml +22 -12
- data/Gemfile +3 -40
- data/LICENSE +1 -2
- data/README.md +1 -2
- data/Rakefile +0 -4
- data/VERSION +1 -1
- data/app/assets/images/blacklight/logo.png +0 -0
- data/app/assets/javascripts/blacklight/ajax_modal.js +190 -0
- data/app/assets/javascripts/blacklight/blacklight.js +7 -17
- data/app/assets/javascripts/blacklight/checkbox_submit.js +1 -1
- data/app/assets/stylesheets/blacklight/{_blacklight_base.scss → _blacklight_base.css.scss} +0 -21
- data/app/assets/stylesheets/blacklight/_bookmark.css.scss +4 -0
- data/app/assets/stylesheets/blacklight/_catalog.css.scss +192 -0
- data/app/assets/stylesheets/blacklight/_facets.css.scss +141 -0
- data/app/assets/stylesheets/blacklight/{_group.scss → _group.css.scss} +1 -1
- data/app/assets/stylesheets/blacklight/_header.css.scss +44 -0
- data/app/assets/stylesheets/blacklight/_layout.css.scss +5 -0
- data/app/assets/stylesheets/blacklight/{_modal.scss → _modal.css.scss} +7 -7
- data/app/assets/stylesheets/blacklight/_search_history.css.scss +20 -0
- data/app/assets/stylesheets/blacklight/{blacklight.scss → blacklight.css.scss} +0 -0
- data/app/assets/stylesheets/blacklight/blacklight_defaults.css.scss +14 -0
- data/app/controllers/bookmarks_controller.rb +0 -4
- data/app/controllers/feedback_controller.rb +0 -4
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +45 -155
- data/app/helpers/blacklight/catalog_helper_behavior.rb +8 -41
- data/app/helpers/blacklight/facets_helper_behavior.rb +20 -43
- data/app/helpers/blacklight/hash_as_hidden_fields_helper_behavior.rb +2 -9
- data/app/helpers/blacklight/render_constraints_helper_behavior.rb +9 -14
- data/app/helpers/blacklight/search_history_constraints_helper_behavior.rb +6 -6
- data/app/views/_flash_msg.html.erb +9 -2
- data/app/views/_user_util_links.html.erb +29 -15
- data/app/views/bookmarks/_tools.html.erb +4 -7
- data/app/views/bookmarks/index.html.erb +3 -2
- data/app/views/catalog/_citation.html.erb +1 -1
- data/app/views/catalog/_constraints.html.erb +1 -1
- data/app/views/catalog/_constraints_element.html.erb +12 -8
- data/app/views/catalog/_did_you_mean.html.erb +2 -2
- data/app/views/catalog/_document_header.html.erb +3 -3
- data/app/views/catalog/_email_form.html.erb +10 -10
- data/app/views/catalog/_facet_layout.html.erb +11 -3
- data/app/views/catalog/_facet_limit.html.erb +7 -7
- data/app/views/catalog/_facet_pagination.html.erb +8 -7
- data/app/views/catalog/_facet_pivot.html.erb +3 -1
- data/app/views/catalog/_facets.html.erb +12 -9
- data/app/views/catalog/_paginate_compact.html.erb +1 -7
- data/app/views/catalog/_per_page_widget.html.erb +5 -8
- data/app/views/catalog/_previous_next_doc.html.erb +11 -9
- data/app/views/catalog/_refworks_form.html.erb +3 -4
- data/app/views/catalog/_results_pagination.html.erb +1 -1
- data/app/views/catalog/_search_form.html.erb +16 -14
- data/app/views/catalog/_show_sidebar.html.erb +7 -9
- data/app/views/catalog/_show_tools.html.erb +13 -7
- data/app/views/catalog/_sms_form.html.erb +8 -8
- data/app/views/catalog/_sort_and_per_page.html.erb +4 -6
- data/app/views/catalog/_sort_widget.html.erb +5 -6
- data/app/views/catalog/email.html.erb +1 -1
- data/app/views/catalog/facet.html.erb +2 -8
- data/app/views/catalog/index.html.erb +11 -6
- data/app/views/catalog/show.html.erb +5 -5
- data/app/views/catalog/sms.html.erb +1 -1
- data/app/views/catalog/sms_sent.html.erb +1 -1
- data/app/views/feedback/complete.html.erb +2 -2
- data/app/views/feedback/show.html.erb +1 -1
- data/app/views/kaminari/blacklight/_paginator.html.erb +1 -1
- data/app/views/kaminari/blacklight_compact/_paginator.html.erb +25 -5
- data/app/views/layouts/blacklight.html.erb +23 -23
- data/app/views/saved_searches/index.html.erb +2 -2
- data/app/views/search_history/index.html.erb +5 -7
- data/app/views/shared/_header_navbar.html.erb +23 -23
- data/blacklight.gemspec +10 -13
- data/config/locales/blacklight.en.yml +1 -12
- data/config/locales/blacklight.fr.yml +1 -12
- data/gemfiles/rails3.gemfile +21 -0
- data/gemfiles/rails4.gemfile +20 -0
- data/lib/blacklight.rb +0 -8
- data/lib/blacklight/base.rb +0 -2
- data/lib/blacklight/catalog.rb +6 -32
- data/lib/blacklight/catalog/search_context.rb +8 -48
- data/lib/blacklight/configurable.rb +2 -1
- data/lib/blacklight/configuration.rb +1 -2
- data/lib/blacklight/configuration/facet_field.rb +0 -2
- data/lib/blacklight/engine.rb +3 -3
- data/lib/blacklight/legacy_controller_methods.rb +1 -64
- data/lib/blacklight/rails/routes.rb +17 -0
- data/lib/blacklight/routes.rb +46 -40
- data/lib/blacklight/solr.rb +1 -0
- data/lib/blacklight/solr/document.rb +21 -42
- data/lib/blacklight/solr/facet_paginator.rb +30 -54
- data/lib/blacklight/solr/request.rb +45 -0
- data/lib/blacklight/solr_helper.rb +16 -53
- data/lib/blacklight/solr_response.rb +0 -6
- data/lib/blacklight/user.rb +2 -7
- data/lib/blacklight/utils.rb +1 -9
- data/lib/generators/blacklight/assets_generator.rb +0 -14
- data/lib/generators/blacklight/blacklight_generator.rb +17 -14
- data/lib/generators/blacklight/templates/blacklight.css.scss +3 -0
- data/lib/generators/blacklight/templates/catalog_controller.rb +4 -1
- data/lib/railties/blacklight.rake +3 -1
- data/solr/sample_solr_documents.yml +641 -0
- data/spec/controllers/application_controller_spec.rb +5 -21
- data/spec/controllers/bookmarks_controller_spec.rb +11 -11
- data/spec/controllers/catalog_controller_spec.rb +122 -119
- data/spec/controllers/search_history_controller_spec.rb +8 -8
- data/spec/features/alternate_controller_spec.rb +5 -5
- data/spec/features/facets_spec.rb +9 -0
- data/spec/features/record_view_spec.rb +1 -1
- data/spec/features/search_filters_spec.rb +97 -41
- data/spec/features/search_results_spec.rb +14 -17
- data/spec/features/search_sort_spec.rb +1 -1
- data/spec/helpers/blacklight_helper_spec.rb +170 -285
- data/spec/helpers/catalog_helper_spec.rb +57 -96
- data/spec/helpers/facets_helper_spec.rb +130 -152
- data/spec/helpers/hash_as_hidden_fields_spec.rb +9 -15
- data/spec/helpers/render_constraints_helper_spec.rb +5 -5
- data/spec/helpers/search_history_constraints_helper_spec.rb +21 -21
- data/spec/lib/blacklight/routes_spec.rb +25 -0
- data/spec/lib/blacklight/solr/request_spec.rb +37 -0
- data/spec/lib/blacklight/solr_response/group_response_spec.rb +2 -2
- data/spec/lib/blacklight_configurable_spec.rb +16 -16
- data/spec/lib/blacklight_configuration_spec.rb +132 -132
- data/spec/lib/blacklight_email_spec.rb +4 -4
- data/spec/lib/blacklight_sms_spec.rb +4 -4
- data/spec/lib/blacklight_solr_document_dublin_core_spec.rb +6 -6
- data/spec/lib/blacklight_solr_document_more_like_this_spec.rb +4 -4
- data/spec/lib/blacklight_solr_document_spec.rb +36 -36
- data/spec/lib/blacklight_solr_response_spec.rb +43 -48
- data/spec/lib/blacklight_spec.rb +6 -14
- data/spec/lib/blacklight_user_spec.rb +5 -9
- data/spec/lib/facet_paginator_spec.rb +59 -51
- data/spec/lib/search_fields_spec.rb +13 -13
- data/spec/lib/solr_helper_spec.rb +258 -304
- data/spec/lib/tasks/blacklight_task_spec.rb +1 -1
- data/spec/lib/utils_spec.rb +16 -46
- data/spec/models/bookmark_spec.rb +6 -7
- data/spec/models/record_mailer_spec.rb +16 -16
- data/spec/models/search_spec.rb +8 -8
- data/spec/models/solr_document_spec.rb +6 -77
- data/spec/routing/catalog_routing_spec.rb +16 -10
- data/spec/spec_helper.rb +7 -7
- data/spec/support/assert_difference.rb +2 -2
- data/spec/support/features.rb +0 -11
- data/spec/support/features/session_helpers.rb +3 -3
- data/spec/support/include_text.rb +2 -2
- data/spec/test_app_templates/Gemfile.extra +10 -2
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +12 -18
- data/spec/views/catalog/_constraints_element.html.erb_spec.rb +13 -13
- data/spec/views/catalog/_document.html.erb_spec.rb +1 -1
- data/spec/views/catalog/_document_list.html.erb_spec.rb +1 -1
- data/spec/views/catalog/_facets.html.erb_spec.rb +13 -14
- data/spec/views/catalog/_index_default.erb_spec.rb +21 -21
- data/spec/views/catalog/_search_header.erb_spec.rb +1 -1
- data/spec/views/catalog/_show_default.erb_spec.rb +21 -21
- data/spec/views/catalog/_show_sidebar.erb_spec.rb +7 -7
- data/spec/views/catalog/_thumbnail_default.erb_spec.rb +3 -3
- data/spec/views/catalog/index.atom.builder_spec.rb +29 -29
- data/spec/views/catalog/index.html.erb_spec.rb +6 -7
- data/tasks/blacklight.rake +8 -2
- metadata +84 -180
- data/app/assets/javascripts/blacklight/css_dropdowns.js +0 -10
- data/app/assets/javascripts/blacklight/facet_expand_contract.js +0 -41
- data/app/assets/javascripts/blacklight/lightbox_dialog.js +0 -70
- data/app/assets/javascripts/blacklight/select_submit.js +0 -27
- data/app/assets/javascripts/blacklight/zebra_stripe.js +0 -13
- data/app/assets/javascripts/improved-modal/bootstrap-modal.js +0 -355
- data/app/assets/javascripts/improved-modal/bootstrap-modalmanager.js +0 -370
- data/app/assets/stylesheets/blacklight/_bookmark.scss +0 -33
- data/app/assets/stylesheets/blacklight/_catalog.scss +0 -255
- data/app/assets/stylesheets/blacklight/_dropdown.scss +0 -57
- data/app/assets/stylesheets/blacklight/_facets.scss +0 -197
- data/app/assets/stylesheets/blacklight/_footer.scss +0 -0
- data/app/assets/stylesheets/blacklight/_header.scss +0 -53
- data/app/assets/stylesheets/blacklight/_layout.scss +0 -10
- data/app/assets/stylesheets/blacklight/_mixins.scss +0 -0
- data/app/assets/stylesheets/blacklight/_print.scss +0 -0
- data/app/assets/stylesheets/blacklight/_responsive.scss +0 -3
- data/app/assets/stylesheets/blacklight/_search_history.scss +0 -42
- data/app/assets/stylesheets/blacklight/blacklight_defaults.scss +0 -49
- data/app/assets/stylesheets/blacklight/responsive_partials/_catalog.scss +0 -5
- data/app/assets/stylesheets/blacklight/responsive_partials/_facets.scss +0 -37
- data/app/assets/stylesheets/blacklight/responsive_partials/_header.scss +0 -30
- data/app/assets/stylesheets/improved-modal/bootstrap-modal.css +0 -217
- data/app/helpers/blacklight/html_head_helper_behavior.rb +0 -118
- data/app/helpers/html_head_helper.rb +0 -3
- data/app/views/catalog/_bookmark_form.html.erb +0 -7
- data/app/views/catalog/_marc_view.html.erb +0 -32
- data/app/views/catalog/librarian_view.html.erb +0 -10
- data/config/routes.rb +0 -17
- data/doc/Atom-Responses.md +0 -90
- data/doc/Blacklight-3.0-Release-Notes-And-Upgrade-Guide.md +0 -107
- data/doc/Blacklight-3.2-Release-Notes-and-Upgrade-Guide.md +0 -191
- data/doc/Blacklight-3.3-release-notes-and-upgrade-guide.md +0 -37
- data/doc/Blacklight-3.4-release-notes-and-upgrade-guide.md +0 -27
- data/doc/Blacklight-3.5-release-notes-and-upgrade-guide.md +0 -44
- data/doc/Blacklight-3.6-release-notes-and-upgrade-guide.md +0 -25
- data/doc/Blacklight-3.7-release-notes-and-upgrade-guide.md +0 -80
- data/doc/Blacklight-3.8-release-notes-and-upgrade-guide.md +0 -11
- data/doc/Blacklight-4.0-release-notes-and-upgrade-guide.md +0 -135
- data/doc/Blacklight-4.1-release-notes-and-upgrade-guide.md +0 -17
- data/doc/Blacklight-4.2-release-notes-and-upgrade-guide.md +0 -25
- data/doc/Blacklight-4.3-release-notes-and-upgrade-guide.md +0 -21
- data/doc/Blacklight-4.4-release-notes-and-upgrade-guide.md +0 -41
- data/doc/Blacklight-Add-ons.md +0 -28
- data/doc/Blacklight-configuration.md +0 -411
- data/doc/Blacklight-on-Heroku.md +0 -135
- data/doc/Code4Lib-2014.md +0 -48
- data/doc/Community-principles.md +0 -44
- data/doc/Configuring-and-Customizing-Blacklight.md +0 -271
- data/doc/Configuring-rails-routes.md +0 -13
- data/doc/Contributing-to-Blacklight.md +0 -25
- data/doc/Examples.md +0 -94
- data/doc/Extending-or-Modifying-Blacklight-Search-Behavior.md +0 -141
- data/doc/FAQs.md +0 -1
- data/doc/Home.md +0 -80
- data/doc/How-to-release-a-version.md +0 -29
- data/doc/Indexing-your-data-into-solr.md +0 -32
- data/doc/Integration-with-Rails-Footnotes.md +0 -20
- data/doc/Internationalization.md +0 -32
- data/doc/JSON-API.md +0 -17
- data/doc/Pagination.md +0 -51
- data/doc/Providing-your-own-view-templates.md +0 -109
- data/doc/Quickstart.md +0 -115
- data/doc/README_SOLR.md +0 -245
- data/doc/Release-Notes-And-Upgrade-Guides.md +0 -20
- data/doc/Roadmap.md +0 -43
- data/doc/Sunspot-for-indexing.md +0 -46
- data/doc/Theming.md +0 -64
- data/doc/User-Authentication.md +0 -60
- data/doc/testing.md +0 -57
- data/lib/SolrMarc.jar +0 -0
- data/lib/blacklight/mash.rb +0 -19
- data/lib/blacklight/solr/document/marc.rb +0 -71
- data/lib/blacklight/solr/document/marc_export.rb +0 -590
- data/lib/generators/blacklight/marc_generator.rb +0 -66
- data/lib/generators/blacklight/templates/blacklight.scss +0 -4
- data/lib/generators/blacklight/templates/config/SolrMarc/config-test.properties +0 -37
- data/lib/generators/blacklight/templates/config/SolrMarc/config.properties +0 -37
- data/lib/generators/blacklight/templates/config/SolrMarc/index.properties +0 -97
- data/lib/generators/blacklight/templates/config/SolrMarc/index_scripts/dewey.bsh +0 -47
- data/lib/generators/blacklight/templates/config/SolrMarc/index_scripts/format.bsh +0 -126
- data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/README_MAPS +0 -1
- data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/callnumber_map.properties +0 -407
- data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/composition_era_map.properties +0 -56
- data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/country_map.properties +0 -379
- data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/format_map.properties +0 -50
- data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/instrument_map.properties +0 -101
- data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/language_map.properties +0 -490
- data/lib/railties/solr_marc.rake +0 -162
- data/spec/data/test_data.utf8.mrc +0 -1
- data/spec/features/librarian_view_spec.rb +0 -13
- data/spec/helpers/html_head_helper_spec.rb +0 -164
- data/spec/lib/blacklight_solr_document_marc_spec.rb +0 -89
- data/spec/lib/marc_export_spec.rb +0 -746
- data/spec/lib/tasks/solr_marc_task_spec.rb +0 -60
- data/spec/requests/alternate_controller_spec.rb +0 -16
- data/spec/routing/routes_spec.rb +0 -20
- data/spec/views/catalog/_constraints.html.erb_spec.rb +0 -33
- data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +0 -49
- data/test_support/data/test_data.utf8.mrc +0 -1
@@ -1,107 +0,0 @@
|
|
1
|
-
This page outlines the basic steps needed to upgrade your customized installation of Blacklight 2.x to work with Blacklight 3.x.
|
2
|
-
|
3
|
-
## Rails 3 Specific Changes:
|
4
|
-
Please see [[http://omgbloglol.com/post/353978923/the-path-to-rails-3-approaching-the-upgrade]] - for a good introduction.
|
5
|
-
|
6
|
-
1. Start by installing Rails3, generate a new app, make sure it works. Doing this not only proves your rails3 installation is working, but it will also get you familiar with the command line tools - which are very different now.
|
7
|
-
1. Now, create a new rails app on top of your existing application. This will make all sorts of modifications, creating and updating your Gemfile, Rakefile, application.rb, locals, new javascript, etc... You should also remove all the files in /script/ except for rails - since these scripts are no longer used.
|
8
|
-
|
9
|
-
```bash
|
10
|
-
$ rails new my_existing_app
|
11
|
-
```
|
12
|
-
|
13
|
-
1. Routes are WAY different in rails 3. Please see [[http://www.engineyard.com/blog/2010/the-lowdown-on-routes-in-rails-3/]]
|
14
|
-
1. Most of your application specific configuration now takes place in a file called `config/application.rb` - you will need to move most of what is currently in your `config/environment.rb` and `config/boot.rb` into this new file.
|
15
|
-
1. The `lib` directory is no longer auto-loaded - and the general recommendation is not to make it so (though it is possible inside of `config/application.rb`) - I went through and added requires methods where and when they are needed in the individual files, which is nice - because now it is far more clear what needs what.
|
16
|
-
1. Rails 3 escapes strings by default. You will have to add `#html_safe` to any ruby string variables that were created 'from scratch' rather than using a "safe" helper (e.g. `content_tag`, `link_to`) which escape the string internally.
|
17
|
-
|
18
|
-
## Other Gems that will need upgrading
|
19
|
-
1. If you were using the ExceptionNotification gem, things have changed in rails, There is a good explanation here:
|
20
|
-
[[http://stackoverflow.com/questions/3524127/exception-notification-gem-and-rails-3]]
|
21
|
-
1. If your are using RSpec, you will need to upgrade it in your gem file to version 2. And you will need to re-run the generator
|
22
|
-
|
23
|
-
```ruby
|
24
|
-
gem 'rspec', '>2.0.0'
|
25
|
-
$ rails generate rspec:install
|
26
|
-
```
|
27
|
-
|
28
|
-
1. Recapcha, and Prawnto - I was previously using these as plugins, but they have good gems now, so I removed these from the plugin directory, and added them to the `Gemfile`.
|
29
|
-
|
30
|
-
1. If you are using the Marc gem, make sure you are running 0.4.1 - ran into some problems related to changes in the way Rails3 handles json prior to this upgrade.
|
31
|
-
|
32
|
-
## Blacklight Specific Changes
|
33
|
-
1. There is no `application_helper.rb` file in Blacklight now. It was moved to `blacklight_helper`, and its methods are made available automatically. (see `blacklight/engine.rb` for more information) So if you were attempting to include this file and override it, don't. Just redefine the methods in your own `ApplicationHelper`, and you should be fine.
|
34
|
-
1. Remove the Blacklight plugin directory from /vendor - since you will be installing in as a gem. Include the Blacklight gem in your `Gemfile` list and run `bundle install`:
|
35
|
-
|
36
|
-
```ruby
|
37
|
-
gem 'blacklight'
|
38
|
-
```
|
39
|
-
|
40
|
-
If you have Blacklight checked out somewhere, you can point to it in your gem file as follows:
|
41
|
-
```ruby
|
42
|
-
gem 'blacklight', :path => '../some/file/path/to/blacklight'
|
43
|
-
```
|
44
|
-
|
45
|
-
1. Most of the customization of Blacklight is done through overriding Blacklight-provided methods and templates. In Virgo you would often see lines like:
|
46
|
-
```ruby
|
47
|
-
require_dependency 'vendor/plugins/blacklight/....
|
48
|
-
```
|
49
|
-
at the top of a file that re-opened the class and made modifications to it.
|
50
|
-
You would now need to change this to:
|
51
|
-
```ruby
|
52
|
-
require "#{Blacklight.controllers_dir}/bookmarks_controller" For controllers, and ...
|
53
|
-
require "#{Blacklight.models_dir}/bookmark" For models.
|
54
|
-
```
|
55
|
-
1. Blacklight no longer includes a `User` model or `SessionController` out of the box. If you want Blacklight to provide user authentication services, you will need to install a separate library. Blacklight recommends Devise, and the Blacklight generator (in the next step) can be used to setup Devise for you.
|
56
|
-
|
57
|
-
If you choose to roll-your-own, you will need to add in whatever you need - in my case, that was just creating a `User` model and include the `Blacklight::User` mixin.
|
58
|
-
|
59
|
-
```ruby
|
60
|
-
class User < ActiveRecord::Base
|
61
|
-
include Blacklight::User
|
62
|
-
acts_as_authentic
|
63
|
-
end
|
64
|
-
```
|
65
|
-
Please also see the notes on the `ApplicationController` below ...
|
66
|
-
|
67
|
-
1. Run the Blacklight Generator - This will add all kinds of files to your local application - including stylesheets, images, jar files, database migrations, etc.. It will try it's best to be "idempotent" - that it is shouldn't mess anything up to run this over and over again. It will verify that the changes it's making are not already in place.
|
68
|
-
```bash
|
69
|
-
$ rails generate blacklight (--devise, if you want Blacklight to install devise or MODEL_NAME, to point at a custom User model)
|
70
|
-
```
|
71
|
-
1. For the most part, you override a controller provided by Blacklight by including the class and then reopening it. That said, the `CatalogController` is generated for you into your application (unless you already have one). Your `CatalogController` should look something like this:
|
72
|
-
```ruby
|
73
|
-
class CatalogController < ApplicationController
|
74
|
-
inlcude Blacklight::Catalog
|
75
|
-
.....
|
76
|
-
end
|
77
|
-
```
|
78
|
-
If you end up overriding a large number of `SolrHelper` methods, you can also override the solr helpers in your own file, and then include that file.
|
79
|
-
```ruby
|
80
|
-
module UVA::SolrHelper
|
81
|
-
include Blacklight::SolrHelper
|
82
|
-
.....
|
83
|
-
end
|
84
|
-
|
85
|
-
class CatalogController < ApplicationController
|
86
|
-
include UVA::SolrHelper
|
87
|
-
include Blacklight::Catalog
|
88
|
-
....
|
89
|
-
end
|
90
|
-
```
|
91
|
-
1. Application Controller
|
92
|
-
The Blacklight generator, will add a line to your `ApplicationController` if isn't there already which will cause the `ApplicationController` to include the base controller logic for Blacklight:
|
93
|
-
```ruby
|
94
|
-
class ApplicationController < ActionController::Base
|
95
|
-
include Blacklight::Controller
|
96
|
-
end
|
97
|
-
```
|
98
|
-
The `Blacklight::Controller` module adds a number of helper methods, forces the the Blacklight layout, adds the `before_filter :default_html_head`. Blacklight by no means requires the inclusion of this file. In the case of Virgo, we do not.
|
99
|
-
|
100
|
-
You will most likely need to define the following methods in your application controller, particularly if you have any sort of custom user authentication.
|
101
|
-
|
102
|
-
* `user_session` - which should return the current rails session object.
|
103
|
-
* `current_user` - which should return a user object that includes `Blacklight::User`
|
104
|
-
* `new_user_session_path` - which should return the path for logging into your application
|
105
|
-
* `destroy_user_session_path` - which should return the path for logging out of your application.
|
106
|
-
|
107
|
-
`SolrDocument` is no longer a file in Blacklight, but rather a generated model in your application, in this way you can easily override and modify the behavior of individual documents. This is automatically created for you, I just wanted to draw you attention to it.
|
@@ -1,191 +0,0 @@
|
|
1
|
-
## Overview
|
2
|
-
|
3
|
-
Blacklight 3.2 introduces a number of new features to Blacklight, including the Rails asset pipeline, a configuration refactor, and support for Solr 3.x by default.
|
4
|
-
|
5
|
-
### Upgrading to Rails 3.1
|
6
|
-
|
7
|
-
If you are still using Rails 3.0, you should first update your project to work with Rails 3.1. Start by fixing any Rails 3.0 deprecation warnings (as those features may no longer exist or fail silently in Rails 3.1). There are some good resources to help you with the upgrade (e.g. [[http://railscasts.com/episodes/282-upgrading-to-rails-3-1?view=asciicast]]).
|
8
|
-
|
9
|
-
### Assets (CODEBASE-363)
|
10
|
-
Blacklight 3.2 uses the Rails 3.1 asset pipeline for all assets, stylesheets and javascript. The CSS has been refactored and now uses SCSS to enable easy changing of some common parameters/colors. In addition, it no longer uses YUI-grids CSS framework. (Instead it uses Susy grid css framework).
|
11
|
-
|
12
|
-
What does this mean for you?
|
13
|
-
|
14
|
-
* Small (hopefully) upgrade costs.
|
15
|
-
|
16
|
-
* Use of the asset pipeline to compress and streamline all css files into one.
|
17
|
-
|
18
|
-
* Easier theming of blacklight.
|
19
|
-
|
20
|
-
After having upgraded to BL 3.2 (and Rails 3.1), the first thing you should do is upgrade to use the asset pipeline. The Blacklight gem's standard behavior for including CSS and Javascript in your app **requires the asset pipeline**. (Of course, if you don't use the CSS or Javascript distributed with Blacklight, or want to roll your own custom way to include it, you could choose to continue without using the asset pipeline)
|
21
|
-
|
22
|
-
Run the Blacklight generator to upgrade from Blacklight 3.1 to 3.2:
|
23
|
-
```
|
24
|
-
$ rails g blacklight
|
25
|
-
```
|
26
|
-
|
27
|
-
This should update the `application.css` and `application.js` files with references to the new Blacklight assets. You will still need to move or update your local assets and customizations.
|
28
|
-
|
29
|
-
**Note**
|
30
|
-
|
31
|
-
* Now, if you have you will need to change your layout to use the new ids, look at: [app/views/layouts/blacklight.html.erb](https://github.com/projectblacklight/blacklight/blob/master/) for reference on the new tags (#page, #bd, #hd, #footer, #main, #main_container, #sidebar). The old yui tags have no meaning in the new css.
|
32
|
-
|
33
|
-
* This also means that any local CSS that overrides Blacklight's CSS, if your uses the old yui-grids id's in your CSS selectors, you probably want to change them to use the new id's. (#doc, #doc2, etc,, as well as any .yui-*)
|
34
|
-
|
35
|
-
* You will need to remove the line `require "yui"` from your `./app/assets/stylesheets/application.css`. In previous versions, Blacklight provided the YUI css library as part of the gem. In Blacklight 3.2, because the Blacklight is no longer using YUI, this has been removed. If you wish to continue using YUI, you will need to provide your own copy in your application. You can download the [Blacklight 3.1 YUI file](https://github.com/projectblacklight/blacklight/blob/release-3.1/app/assets/stylesheets/yui.css) or from the (Yahoo YUI site)[http://developer.yahoo.com/yui/2/].
|
36
|
-
|
37
|
-
### Per-controller configuration (CODEBASE-365)
|
38
|
-
|
39
|
-
In previous versions of Blacklight, configuring Blacklight was done using a global configuration hash called `Blacklight.config` (created in `config/initializers/blacklight_config.rb`). Blacklight 3.2 deprecates this global configuration in favor of a per-controller, DSL-style configuration. Support for the old-style configuration is still available (meaning, if you do absolutely nothing, Blacklight will convert Blacklight.config into the new-style configuration, and your application will probably continue to work), but we strongly recommend applications switch to the new-style configuration.
|
40
|
-
|
41
|
-
The two major changes are moving from the global configuration (`Blacklight.config`) to a Controller-specific method (`blacklight_config`) and replacing the hash-based access with an OpenStruct-based domain-specific language. The new style maintains many of the old semantics, but should be better structured and more clear.
|
42
|
-
|
43
|
-
On your CatalogController, you can configure the Blacklight Catalog:
|
44
|
-
|
45
|
-
```ruby
|
46
|
-
class CatalogController < ApplicationController
|
47
|
-
|
48
|
-
include Blacklight::Catalog
|
49
|
-
|
50
|
-
configure_blacklight do |config|
|
51
|
-
config.default_solr_params = {
|
52
|
-
:qt => 'search',
|
53
|
-
:rows => 10
|
54
|
-
}
|
55
|
-
|
56
|
-
# solr field configuration for search results/index views
|
57
|
-
config.index.show_link = 'title_display'
|
58
|
-
config.index.record_display_type = 'format'
|
59
|
-
|
60
|
-
# solr field configuration for document/show views
|
61
|
-
config.show.html_title = 'title_display'
|
62
|
-
config.show.heading = 'title_display'
|
63
|
-
config.show.display_type = 'format'
|
64
|
-
|
65
|
-
# ....
|
66
|
-
end
|
67
|
-
|
68
|
-
# ...
|
69
|
-
end
|
70
|
-
|
71
|
-
```
|
72
|
-
|
73
|
-
|
74
|
-
#### Creating a new configuration
|
75
|
-
|
76
|
-
An example of the new style configuration is available at
|
77
|
-
[[https://github.com/projectblacklight/blacklight/blob/master/lib/generators/blacklight/templates/catalog_controller.rb]] and shows most of the ways one can use the new configuration.
|
78
|
-
|
79
|
-
There are helper methods for adding field configuration (facets, index, and show fields) as well as search and sort fields. All of these methods accept a variety of inputs and should be used in local applications in whatever form is most clear.
|
80
|
-
|
81
|
-
Field + configuration hash
|
82
|
-
|
83
|
-
```ruby
|
84
|
-
config.add_facet_field 'format', :label => 'Format'
|
85
|
-
```
|
86
|
-
|
87
|
-
Configuration hash
|
88
|
-
|
89
|
-
```ruby
|
90
|
-
config.add_sort_field :sort => 'score desc, pub_date_sort desc, title_sort asc', :label => 'relevance'
|
91
|
-
```
|
92
|
-
|
93
|
-
Field + block
|
94
|
-
|
95
|
-
```ruby
|
96
|
-
config.add_search_field('title') do |field|
|
97
|
-
# solr_parameters hash are sent to Solr as ordinary url query params.
|
98
|
-
field.solr_parameters = { :'spellcheck.dictionary' => 'title' }
|
99
|
-
|
100
|
-
# :solr_local_parameters will be sent using Solr LocalParams
|
101
|
-
# syntax, as eg {! qf=$title_qf }. This is neccesary to use
|
102
|
-
# Solr parameter de-referencing like $title_qf.
|
103
|
-
# See: http://wiki.apache.org/solr/LocalParams
|
104
|
-
field.solr_local_parameters = {
|
105
|
-
:qf => '$title_qf',
|
106
|
-
:pf => '$title_pf'
|
107
|
-
}
|
108
|
-
end
|
109
|
-
```
|
110
|
-
|
111
|
-
#### Using the new configuration
|
112
|
-
|
113
|
-
Within a controller, the configuration can be accessed using the method `blacklight_config`, which is also exposed to helpers or views as a helper method.
|
114
|
-
|
115
|
-
Outside of a controller context (which should be rare, and likely undesirable), the configuration is exposed at the class level as well, e.g.:
|
116
|
-
|
117
|
-
```ruby
|
118
|
-
CatalogController.blacklight_config
|
119
|
-
```
|
120
|
-
|
121
|
-
Some configuration-driven helper methods have also been moved to the configuration object:
|
122
|
-
|
123
|
-
```ruby
|
124
|
-
blacklight_config.default_search_field
|
125
|
-
blacklight_config.default_sort_field
|
126
|
-
blacklight_config.max_per_page
|
127
|
-
```
|
128
|
-
|
129
|
-
The Blacklight field configuration are stored as ordered hashes, with a key corresponding to the field name:
|
130
|
-
|
131
|
-
```ruby
|
132
|
-
CatalogController.blacklight_config.facet_fields
|
133
|
-
|
134
|
-
# {
|
135
|
-
# "format" => #<Blacklight::Configuration::FacetField:0x1025a0c78
|
136
|
-
# :label => "Format",
|
137
|
-
# :field => "format"
|
138
|
-
# >,
|
139
|
-
# "pub_date" => #<Blacklight::Configuration::FacetField:0x1025a7aa0
|
140
|
-
# :label => "Publication Year",
|
141
|
-
# :field => "pub_date"
|
142
|
-
# >,
|
143
|
-
# ...
|
144
|
-
```
|
145
|
-
|
146
|
-
Values can be accessed using OpenStruct methods or as a Hash:
|
147
|
-
|
148
|
-
```ruby
|
149
|
-
CatalogController.blacklight_config.facet_fields["format"].label # == "Format"
|
150
|
-
CatalogController.blacklight_config.facet_fields["format"][:label] # == "Format"
|
151
|
-
```
|
152
|
-
|
153
|
-
### Using the new-style config in local overrides
|
154
|
-
If you have overriden views or helpers in your local application and access `Blacklight.config` directly, you will need to update your overrides. In general, you should be able to search for references to `Blacklight.config` in your local application, replace it with the controller-level method `blacklight_config` and possibly fix up some naming differences.
|
155
|
-
|
156
|
-
### Facet refactor
|
157
|
-
Facet helpers and views have been refactored to take advantage of the new configuration style and new features in Rails.
|
158
|
-
|
159
|
-
The old `_facet_limit` view has been split in two,
|
160
|
-
|
161
|
-
* `_facet_limit` : the partial to display the facet values
|
162
|
-
* `_facet_layout` : a 'partial layout' that displays the facet structure and headers
|
163
|
-
|
164
|
-
In the facet configuration, you can specify the partial to use to render a facet:
|
165
|
-
```ruby
|
166
|
-
config.add_facet_field 'format', :label => 'Format', :partial => 'my_custom_format_facet_display_partial'
|
167
|
-
```
|
168
|
-
|
169
|
-
### Solr 3.5 (CODEBASE-345)
|
170
|
-
Blacklight-jetty has been updated to Solr 3.5 (previously it was still Solr 1.4). Blacklight is still compatible with both Solr 1.x and 3.x, but the demo application is based on a Solr 3.x configuration.
|
171
|
-
|
172
|
-
#### SolrMarc 2.3.1
|
173
|
-
Older versions of SolrMarc were incompatible with Solr 3.x. Blacklight is now distributed with SolrMarc 2.3.1. But previous versions of Blacklight erroneously copied a SolrMarc.jar into your local app's lib/SolrMarc.jar when installing Blacklight.
|
174
|
-
|
175
|
-
If you have a previously installed Blacklight, unless you have intentionally installed a local compile of SolrMarc.jar, you should remove the file at local ./lib/SolrMarc.jar, so your app will use the latest version of SolrMarc shipped with Blacklight.
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
### Other changes
|
180
|
-
|
181
|
-
* [CODEBASE-325](http://jira.projectblacklight.org/jira/browse/CODEBASE-325) - Allow Blacklight to function correctly when no user authentication system is provided
|
182
|
-
* [CODEBASE-362](http://jira.projectblacklight.org/jira/browse/CODEBASE-362) - Blacklight facets do not work with integer-type fields
|
183
|
-
* [CODEBASE-367](http://jira.projectblacklight.org/jira/browse/CODEBASE-367) - Pull in Hydra's jettywrapper to manage jetty
|
184
|
-
* [CODEBASE-369](http://jira.projectblacklight.org/jira/browse/CODEBASE-369) - Advanced Search has an incompatible character encoding issue under ruby 1.9
|
185
|
-
* [CODEBASE-371](http://jira.projectblacklight.org/jira/browse/CODEBASE-371) - SolrHelper#get_solr_response_for_field_values does not adequately escape value lists
|
186
|
-
* [CODEBASE-375](http://jira.projectblacklight.org/jira/browse/CODEBASE-375) - fix rake solr:marc:index task and generator to use distro SolrMarc.jar
|
187
|
-
* [CODEBASE-376](http://jira.projectblacklight.org/jira/browse/CODEBASE-376) - Look at the did_you_mean.feature scenarios, review for accuracy.
|
188
|
-
* [CODEBASE-377](http://jira.projectblacklight.org/jira/browse/CODEBASE-377) - Convert opensearch.xml.erb to true XML builder style
|
189
|
-
* [CODEBASE-379](http://jira.projectblacklight.org/jira/browse/CODEBASE-379) - Factor out use of RSolr's pagination feature and use Solr's start/rows parameters instead
|
190
|
-
* [CODEBASE-380](http://jira.projectblacklight.org/jira/browse/CODEBASE-380) - ActionMailer deprecations
|
191
|
-
|
@@ -1,37 +0,0 @@
|
|
1
|
-
Issues: https://github.com/projectblacklight/blacklight/issues?milestone=2&state=open
|
2
|
-
|
3
|
-
## Upgrade notes:
|
4
|
-
|
5
|
-
Note: Please make sure to upgrade to at least Blacklight **3.3.1** to avoid problems with compiled assets in 3.3.0.
|
6
|
-
|
7
|
-
If you previously ran the blacklight 3.3.0 generator, after upgrading to 3.3.1: Edit your local `./app/assets/stylesheets/blacklight_themes/standard.css.scss` file, change the line (wrong) `@import 'blacklight/grids/susy';` to instead be (right) `@import 'blacklight/grids/susy_grid';`
|
8
|
-
|
9
|
-
If you previously ran the blacklight 3.2.x or 3.3.0 generator, look in your local `./config/application.rb`, *remove* the line `config.sass.line_comments = Rails.env.development?` if present.
|
10
|
-
|
11
|
-
### Compass/susy upgrade
|
12
|
-
|
13
|
-
[Compass](https://github.com/chriseppstein/compass) (our CSS framework) and [Susy](http://susy.oddbird.net/) have been updated to a new major release. This will necessitate some changes in installations already running BL 3.2.
|
14
|
-
|
15
|
-
New installations should just use the generator as normal.
|
16
|
-
|
17
|
-
Existing installations should do the following:
|
18
|
-
|
19
|
-
**1.** In your gemfile, in `group :assets`, remove any reference to the compass gem, and add:
|
20
|
-
|
21
|
-
gem 'sass-rails', '~> 3.2.0'
|
22
|
-
gem 'compass-rails', '~> 1.0.0'
|
23
|
-
gem 'compass-susy-plugin', '~> 0.9.0'
|
24
|
-
|
25
|
-
**2.** You can remove 'config/initializers/sass.rb'
|
26
|
-
|
27
|
-
**3.** You must add, if you have not already: 'config/compass.rb'
|
28
|
-
|
29
|
-
require 'susy'
|
30
|
-
project_type = :rails
|
31
|
-
|
32
|
-
**4.** Replace any references in your css:
|
33
|
-
|
34
|
-
`@import "blacklight/grids/susy_framework"` with `@import "susy"`
|
35
|
-
|
36
|
-
`@import "blacklight/grids/susy"` with `@import "blacklight/grids/susy_grid"`
|
37
|
-
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# Blacklight 3.4 Release notes
|
2
|
-
Blacklight 3.4.0 is now available. It fixes a number of bugs and
|
3
|
-
tests, but also adds a handful of new features.
|
4
|
-
|
5
|
-
- Fixed Rails 3.1 compatibility for rspec tests
|
6
|
-
- changes to make Blacklight work better with arbitrary solr indexes.
|
7
|
-
- Use ERb to parse the solr.yml configuration (allowing environment
|
8
|
-
variables to be referenced in the config)
|
9
|
-
- fixed #351, saving Selected Items (Folder) to Bookmarks
|
10
|
-
(SavedRecords), more than 10.
|
11
|
-
- fixed #398 document fetching/config refactor, which elevates
|
12
|
-
document-request solr parameters into the controller's
|
13
|
-
blacklight_config.
|
14
|
-
- fixed #333, Blacklight should throw more helpful errors if it
|
15
|
-
unable to connect to Solr
|
16
|
-
- fixed #96, supporting configurable request handler paths
|
17
|
-
|
18
|
-
The full list of Github issues are at:
|
19
|
-
https://github.com/projectblacklight/blacklight/issues?milestone=4&state=closed
|
20
|
-
|
21
|
-
Also, the GitHub compare view of this release vs. our last release is
|
22
|
-
located at:
|
23
|
-
https://github.com/projectblacklight/blacklight/compare/v3.3.0...v3.4.0
|
24
|
-
|
25
|
-
# Upgrade notes
|
26
|
-
|
27
|
-
No known issues updating from 3.3 to 3.4.
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# Blacklight 3.5 Release Notes And Upgrade Guide
|
2
|
-
|
3
|
-
## Release Notes
|
4
|
-
# Blacklight 3.5 Release notes
|
5
|
-
Blacklight 3.5.0 is now available. It introduces i18n support for Blacklight, allowing applications to change and modify Blacklight-provided text strings without the need to override partials (in addition to providing multi-lingual support).
|
6
|
-
|
7
|
-
- Fix #395, removing hard-coded no-reply@ email addresses from the ```RecordMailer``` (see below for upgrade notes)
|
8
|
-
- Consistent use of polymorphic routing to the show views for documents. ```solr_document_url``` and ```solr_document_path``` are now part of the engine-provided routes, rather than helper-provided.
|
9
|
-
- Refactor `blacklight.js` to take advantage of the Rails asset pipeline by moving separate blocks of code into individual files.
|
10
|
-
- Fix problem with mounting Blacklight applications at a suburi rather than a document.
|
11
|
-
|
12
|
-
The full list of Github issues are at:
|
13
|
-
https://github.com/projectblacklight/blacklight/issues?milestone=7&state=closed
|
14
|
-
|
15
|
-
Also, the GitHub compare view of this release vs. our last release is
|
16
|
-
located at:
|
17
|
-
https://github.com/projectblacklight/blacklight/compare/v3.4.2...release-3.5
|
18
|
-
|
19
|
-
|
20
|
-
## Upgrade Guide
|
21
|
-
|
22
|
-
No known issues updating from 3.4 to 3.5.
|
23
|
-
|
24
|
-
## i18n
|
25
|
-
|
26
|
-
Blacklight 3.5 introduces i18n (internationalization framework) support. See the Ruby on Rails [[i18n Rails guide|http://guides.rubyonrails.org/i18n.html]] for information on how to use i18n within your application. The list of blacklight-provided (English) translations are available in the engine's [[```config/locales/blacklight.en.yml```|https://github.com/projectblacklight/blacklight/blob/master/config/locales/blacklight.en.yml]]
|
27
|
-
|
28
|
-
## RecordMailer default email
|
29
|
-
|
30
|
-
In config/environments/development.rb:
|
31
|
-
```ruby
|
32
|
-
ActionMailer::Base.default :from => 'default@development-server.com'
|
33
|
-
```
|
34
|
-
|
35
|
-
In config/environments/production.rb:
|
36
|
-
```ruby
|
37
|
-
ActionMailer::Base.default :from => 'default@production-server.com'
|
38
|
-
```
|
39
|
-
|
40
|
-
You can also target the RecordMailer directly:
|
41
|
-
|
42
|
-
```ruby
|
43
|
-
RecordMailer.default :from => 'no-reply@projectblacklight.org'
|
44
|
-
```
|
@@ -1,25 +0,0 @@
|
|
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
|
@@ -1,80 +0,0 @@
|
|
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
|
-
If you are using `devise-guests`, you will want to regularly run a rake task it provides to purge old 'guest' data from your database: `RAILS_ENV=production rake devise_guests:delete_old_guest_users[7]`
|
14
|
-
|
15
|
-
### Implementation details for those not using devise.
|
16
|
-
|
17
|
-
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.
|
18
|
-
|
19
|
-
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.
|
20
|
-
|
21
|
-
## Query Facets
|
22
|
-
|
23
|
-
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.
|
24
|
-
|
25
|
-
The Publish Date facet is using this configuration:
|
26
|
-
|
27
|
-
```ruby
|
28
|
-
config.add_facet_field 'example_query_facet_field', :label => 'Publish Date', :query => {
|
29
|
-
:years_5 => { :label => 'within 5 Years', :fq => "pub_date:[#{Time.now.year - 5 } TO *]" },
|
30
|
-
:years_10 => { :label => 'within 10 Years', :fq => "pub_date:[#{Time.now.year - 10 } TO *]" },
|
31
|
-
:years_25 => { :label => 'within 25 Years', :fq => "pub_date:[#{Time.now.year - 25 } TO *]" }
|
32
|
-
}
|
33
|
-
```
|
34
|
-
|
35
|
-
The first argument (which maps to the facet field for plain facets) is used in the Blacklight URL when the facet is selected.
|
36
|
-
|
37
|
-
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.
|
38
|
-
|
39
|
-
|
40
|
-
### A small change to the Blacklight configuration to get Blacklight to generate facet.query for you.
|
41
|
-
|
42
|
-
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:
|
43
|
-
|
44
|
-
```
|
45
|
-
config.default_solr_params[:'facet.field'] = config.facet_fields.keys
|
46
|
-
```
|
47
|
-
|
48
|
-
In the new model, this logic is deferred as part of the Blacklight solr search params logic. The above line should be replaced with:
|
49
|
-
|
50
|
-
```
|
51
|
-
# Have BL send all facet field names to Solr, which has been the default
|
52
|
-
# previously. Simply remove these lines if you'd rather use Solr request
|
53
|
-
# handler defaults, or have no facets.
|
54
|
-
config.add_facet_fields_to_solr_request!
|
55
|
-
```
|
56
|
-
|
57
|
-
This will add the plain facets to the ```facet.field``` and the query facets to the ```facet.query```.
|
58
|
-
|
59
|
-
### Adding facet queries to the solr request handler yourself
|
60
|
-
|
61
|
-
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.
|
62
|
-
|
63
|
-
So, given this Solr response:
|
64
|
-
|
65
|
-
```xml
|
66
|
-
<lst name="facet_counts">
|
67
|
-
<lst name="facet_queries">
|
68
|
-
<int name="lc_alpha_facet:A">0</int>
|
69
|
-
</lst>
|
70
|
-
...
|
71
|
-
</lst>
|
72
|
-
```
|
73
|
-
|
74
|
-
The Blacklight-side config would look something like:
|
75
|
-
|
76
|
-
```ruby
|
77
|
-
config.add_facet_field 'contrived_blacklight_configuration_example', :query => {
|
78
|
-
:a => { :label => 'starting with A', :fq => "lc_alpha_facet:A" },
|
79
|
-
}
|
80
|
-
```
|