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,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,135 +0,0 @@
|
|
1
|
-
# Blacklight 3.6 Release Notes And Upgrade Guide
|
2
|
-
|
3
|
-
## Release Notes
|
4
|
-
|
5
|
-
- Remove dependency on RSolr::Ext. In this first stage, some RSolr::Ext code is now maintained in Blacklight, e.g.:
|
6
|
-
- RSolr::Ext::Response::Facets => Blacklight::SolrResponse::Facets
|
7
|
-
- RSolr::Ext::Doc => Blacklight::Solr::Document
|
8
|
-
- etc
|
9
|
-
|
10
|
-
- Bootstrap-based view templates and default stylesheet; removed compass/susy
|
11
|
-
- Drop support for Ruby 1.8; add support for Ruby 2.0
|
12
|
-
|
13
|
-
And the usual bug-fixes (some of which are backported into 3.8.x):
|
14
|
-
|
15
|
-
- fix #64, show MoreLikeThis titles on record show page if available
|
16
|
-
- fix #422; show prev/next options even when not linked
|
17
|
-
- fix #450; support Solr 4.x and use it by default.
|
18
|
-
- fix #484, use top-level constant BLACKLIGHT_VERBOSE_LOGGING (uninitialized by default) to log the full solr response with each solr query
|
19
|
-
- fix #495 Remove blacklight_config.rb template
|
20
|
-
- fix #496, removing hard-coded 'id' field reference in BookmarksController
|
21
|
-
- remove unicode as an explicit Blacklight dependency, but use it if it is available
|
22
|
-
- fix #499 When document_heading is an array, don't draw the array bracket…
|
23
|
-
- fix #502, Endnote action tries to render partials and gives error
|
24
|
-
- update per_page widget to use i18n strings; don't require echoParams
|
25
|
-
- use 1.9-style string interpolation for template path lookups
|
26
|
-
- consolidate solr pagination information lookup.
|
27
|
-
|
28
|
-
## Plugins Compatibility
|
29
|
-
|
30
|
-
As of 11/26:
|
31
|
-
|
32
|
-
### Tested/Compatible
|
33
|
-
|
34
|
-
* blacklight_advanced_search
|
35
|
-
* blacklight_cql
|
36
|
-
* blacklight_range_limit
|
37
|
-
* blacklight_browse_nearby
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
## Upgrade Guide
|
43
|
-
|
44
|
-
When approaching the Blacklight 3.x => 4.0 upgrade, we'd strongly recommend adopting the bootstrap templates, update local overrides to use bootstrap, and do your own bootstrap stylesheet customization.
|
45
|
-
|
46
|
-
That said, it should be possible to do a fairly straightforward in-place upgrade if you so choose. Most of the Blacklight 4.x work was limited to views, javascript and stylesheets. If you want to keep the old Blacklight theme, you should be able to grab them from Blacklight and drop them into your application directly. We wouldn't recommend it though.
|
47
|
-
|
48
|
-
To upgrade your application to Blacklight 4.x:
|
49
|
-
|
50
|
-
- Update your application's gem dependency to use Blacklight 4.0:
|
51
|
-
|
52
|
-
```ruby
|
53
|
-
gem 'blacklight', "~>4.0"
|
54
|
-
```
|
55
|
-
|
56
|
-
- Add the unicode gem to your application's Gemfile (if you want to use it to normalize character encoding for refworks integration):
|
57
|
-
|
58
|
-
```ruby
|
59
|
-
gem 'unicode'
|
60
|
-
```
|
61
|
-
|
62
|
-
- Remove compass/susy references; replace with bootstrap-sass:
|
63
|
-
|
64
|
-
```ruby
|
65
|
-
# REMOVE:
|
66
|
-
gem 'compass-rails', '~> 1.0.0', :group => :assets
|
67
|
-
gem 'compass-susy-plugin', '~> 0.9.0', :group => :assets
|
68
|
-
|
69
|
-
# ADD:
|
70
|
-
gem 'bootstrap-sass'
|
71
|
-
```
|
72
|
-
|
73
|
-
- (Remember to ```bundle install```)
|
74
|
-
|
75
|
-
- Add the following into your stylesheets directory (possibly as ```app/assets/stylesheets/blacklight.css.scss```):
|
76
|
-
|
77
|
-
```scss
|
78
|
-
@import 'bootstrap';
|
79
|
-
@import 'bootstrap-responsive';
|
80
|
-
|
81
|
-
@import 'blacklight/blacklight';
|
82
|
-
```
|
83
|
-
|
84
|
-
You no longer need the ```blacklight_themes directory``` and can remove ```require 'blacklight_themes/standard'``` (and the jquery UI css) from your application.css
|
85
|
-
|
86
|
-
In ```app/assets/javascripts/application.js```, you can also remove
|
87
|
-
|
88
|
-
```javascript
|
89
|
-
//= require jquery-ui
|
90
|
-
```
|
91
|
-
|
92
|
-
- If you have local overrides of stylesheets, javascript or view templates, you should update them appropriately. Be warned that some of the bootstrapped Blacklight HTML element classes and IDs may have shifted slightly, and the previous susy-grid and YUI class names have been removed.
|
93
|
-
|
94
|
-
In your `ApplicationController`, you need to tell your application which layout to use:
|
95
|
-
|
96
|
-
```ruby
|
97
|
-
# completely Blacklight 3.x-backwards compatible
|
98
|
-
layout :choose_layout
|
99
|
-
|
100
|
-
# if you don't need dynamic layout switching, just do the Rails-standard:
|
101
|
-
layout 'blacklight'
|
102
|
-
```
|
103
|
-
|
104
|
-
- If you are using devise-guests, you probably want to update to devise-guests ~> 0.3. After doing so,
|
105
|
-
|
106
|
-
```bash
|
107
|
-
$ rails g devise_guests
|
108
|
-
$ rake db:migrate
|
109
|
-
```
|
110
|
-
|
111
|
-
If you've already chosen a different layout for your application, you don't need to do anything at all.
|
112
|
-
|
113
|
-
Here are some minor differences elsewhere:
|
114
|
-
|
115
|
-
- Some i18n strings have been updated to read better in the new UI
|
116
|
-
- the helper `#render_document_heading` returns an h4 instead of an h1.
|
117
|
-
- the helper `#document_show_fields` returns a hash instead of a list of keys
|
118
|
-
|
119
|
-
## Document partial paths
|
120
|
-
|
121
|
-
The default naming convention for format-specific partials was changed. In Blacklight 3.1, the default format-specific path was changed to `catalog/_index_[format_name].html.erb`, but support for the Blacklight 2.x style was left in place. In Blacklight 4, the Blacklight 2.x style was removed from the list of defaults.
|
122
|
-
|
123
|
-
So, if you have partials in a directory like:
|
124
|
-
|
125
|
-
```ruby
|
126
|
-
catalog/_index_partials/[format_name].html.erb
|
127
|
-
```
|
128
|
-
|
129
|
-
they should be moved to
|
130
|
-
|
131
|
-
```ruby
|
132
|
-
catalog/_index_[format_name].html.erb
|
133
|
-
```
|
134
|
-
|
135
|
-
Or, alternatively, you may override the helpers [document_index_path_templates](https://github.com/projectblacklight/blacklight/blob/master/app/helpers/blacklight/blacklight_helper_behavior.rb#L382) and [document_partial_path_templates](https://github.com/projectblacklight/blacklight/blob/master/app/helpers/blacklight/blacklight_helper_behavior.rb#L423) with a custom naming convention.
|
@@ -1,17 +0,0 @@
|
|
1
|
-
## Release Notes
|
2
|
-
Bug fixes include:
|
3
|
-
|
4
|
-
- #529 Responsive facet collapsing is not JS degradable
|
5
|
-
- #528 Reset "page" param on "per_page" change
|
6
|
-
|
7
|
-
And some minor feature enhancements, highlights include:
|
8
|
-
- #523 Pass the document object into helper methods so local overrides can make rendering decisions based on the current document
|
9
|
-
- #522 Make it easier to add custom SolrField fields in the Blacklight config
|
10
|
-
- add a #blacklight_solr accessor (intended to replace the global Blacklight.solr)
|
11
|
-
- a French locale translation for Blacklight (thanks @biblimathieu!)
|
12
|
-
|
13
|
-
There's a handful of Rails 4 deprecation warnings and improvements that still need to happen, but this release fixed all major blockers and relaxes the Rails version dependency.
|
14
|
-
|
15
|
-
## Upgrade Guide
|
16
|
-
|
17
|
-
No known issues.
|
@@ -1,25 +0,0 @@
|
|
1
|
-
## Release Notes
|
2
|
-
### 4.2.0
|
3
|
-
Bug fixes include:
|
4
|
-
|
5
|
-
- jQuery 1.9 compatibility (#545 and others)
|
6
|
-
- #548 remove duplicate favicon link tag
|
7
|
-
- #546 more straightforward testing (deprecating the test_support/bin/* scripts in favor of just 'rake')
|
8
|
-
- #549 add :helper_method to add_facet_field (similar to add_index/show_field) documented in [1]
|
9
|
-
|
10
|
-
### 4.2.1
|
11
|
-
Bug fixes include:
|
12
|
-
|
13
|
-
- Rails 4 support
|
14
|
-
- #554 enable users to update bootstrap-sass to the latest version
|
15
|
-
- #557 add the post route for sending email
|
16
|
-
- #559 Remove unnecessary require of 'mash' which was causing "uninitialized constant HashWithIndifferentAccess"
|
17
|
-
- Fixed issue with refworks exports [156e76](https://github.com/projectblacklight/blacklight/commit/156e7680630fcbae2defa4d07f1e1c0aabc67944)
|
18
|
-
|
19
|
-
### 4.2.2
|
20
|
-
|
21
|
-
Minor fixes for Rails 4.0 final release.
|
22
|
-
|
23
|
-
## Upgrade Guide
|
24
|
-
|
25
|
-
No known issues.
|
@@ -1,21 +0,0 @@
|
|
1
|
-
## Release Notes
|
2
|
-
### 4.3.0
|
3
|
-
Bug fixes include:
|
4
|
-
|
5
|
-
- #556 check that a highlight field exists before trying to render it.
|
6
|
-
- #561 Redirect to home page on a missing document
|
7
|
-
- #569 Applies header style to `#header-navbar-fixed-top .brand` in order to avoid trumping other Bootstrap navbars.
|
8
|
-
- use `#facet_configuration_for_field` to render search history constraints for consistency and configuration-independence
|
9
|
-
|
10
|
-
Other changes:
|
11
|
-
- deprecate `#sidebar_items`, and stop populating it with content.
|
12
|
-
- provide a `SOLR_URL` ENV variable to set the location of the development solr core
|
13
|
-
- fix Rails 4-related deprecation warnings
|
14
|
-
|
15
|
-
[[Changes|https://github.com/projectblacklight/blacklight/compare/v4.2.2...v4.3.0]]
|
16
|
-
|
17
|
-
## Upgrade Guide
|
18
|
-
|
19
|
-
Application overrides that used the CSS selector `.navbar .brand` to change the navbar styling should use `#header-navbar-fixed-top .brand` instead.
|
20
|
-
|
21
|
-
Applications that used content from `#sidebar_items` must populate that content themselves (by rendering it directly in their partial, or in some other application-specific way).
|
@@ -1,41 +0,0 @@
|
|
1
|
-
## Release Notes
|
2
|
-
### 4.4.0
|
3
|
-
|
4
|
-
|
5
|
-
Features
|
6
|
-
- [#598](https://github.com/projectblacklight/blacklight/issues/598) Show thumbnails (if available) for documents in search results
|
7
|
-
- [#594](https://github.com/projectblacklight/blacklight/issues/594) Provide Blacklight configuration support for linking field values to facets
|
8
|
-
- [#589](https://github.com/projectblacklight/blacklight/issues/589) Support Rails 4.x-style turbolinks (Blacklight-provided javascript should be loaded on document ready or the page:load event)
|
9
|
-
- [#588](https://github.com/projectblacklight/blacklight/issues/588) Provide an (experimental) JSON API for search and show
|
10
|
-
- [#577](https://github.com/projectblacklight/blacklight/issues/477) Add Solr Field Collapsing feature, if the Solr response includes a grouped element.
|
11
|
-
|
12
|
-
Bug Fixes
|
13
|
-
- [#640](https://github.com/projectblacklight/blacklight/issues/640) Fix the solr query Blacklight generates when the query contains Solr "local parameters" containing digits (e.g. $pf2_value)
|
14
|
-
- [#590](https://github.com/projectblacklight/blacklight/issues/590) Fix transferring unregistered guest user bookmarks to a newly registered user
|
15
|
-
- [#587](https://github.com/projectblacklight/blacklight/issues/587) Fix Zotero support, where ampersands in the context object were being double escaped
|
16
|
-
- [#534](https://github.com/projectblacklight/blacklight/issues/534) Blacklight::CatalogHelperBehavior#paginate_params values of first_page? and last_page? incorrectly set?
|
17
|
-
- [#525](https://github.com/projectblacklight/blacklight/issues/525) Add i18n support to Bookmarks javascript replacement
|
18
|
-
- [#585](https://github.com/projectblacklight/blacklight/issues/585) Add keyboard accessibility to the facet expanders
|
19
|
-
- [#563](https://github.com/projectblacklight/blacklight/issues/563) Login page should have focus in the email field, not the search field.
|
20
|
-
|
21
|
-
Other Improvements
|
22
|
-
- [#600](https://github.com/projectblacklight/blacklight/issues/600) Decomposing blacklight generator
|
23
|
-
- [#599](https://github.com/projectblacklight/blacklight/issues/599) Improving speed of blacklight generator
|
24
|
-
- [#597](https://github.com/projectblacklight/blacklight/issues/597) Rewrite document_counter logic in header
|
25
|
-
- [#596](https://github.com/projectblacklight/blacklight/issues/596) Don't generate devise views by default
|
26
|
-
- [#595](https://github.com/projectblacklight/blacklight/issues/595) Support kaminari pagination helpers in Blacklight::SolrResponse (kaminari can now work with our SolrResponse objects natively).
|
27
|
-
- [#591](https://github.com/projectblacklight/blacklight/issues/591) Remove cucumber. All features have been ported to rspec feature tests.
|
28
|
-
- [#584](https://github.com/projectblacklight/blacklight/issues/584) Move onload_text out of layouts/blacklight.html.erb
|
29
|
-
- [#515](https://github.com/projectblacklight/blacklight/issues/515) Ensure we run bundle install after generating bootstrap-sass into the Gemfile
|
30
|
-
- Update lightbox_dialog.js - Adding an event for DOM change when modal is already shown
|
31
|
-
- [#607](https://github.com/projectblacklight/blacklight/issues/607) Refactor catalog#email and catalog#sms methods
|
32
|
-
- [#609](https://github.com/projectblacklight/blacklight/issues/609) The solr facet :ex local parameter should work with pivot and facet
|
33
|
-
field configurations.
|
34
|
-
- Convert some bare strings to i18n strings
|
35
|
-
- [#608](https://github.com/projectblacklight/blacklight/issues/608) Use ActiveRecord query methods in Blacklight::User mixin
|
36
|
-
|
37
|
-
[[Changes|https://github.com/projectblacklight/blacklight/compare/v4.3.0...v4.4.0]]
|
38
|
-
|
39
|
-
## Upgrade Guide
|
40
|
-
|
41
|
-
If you've overridden the `catalog/sms.html.erb` template or `RecordMailer#sms` action (e.g. to add custom SMS provider mappings), you should look at the changes in [this patch](https://github.com/projectblacklight/blacklight/pull/607), which moved the mappings and validation into the controller.
|
data/doc/Blacklight-Add-ons.md
DELETED
@@ -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,411 +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.yml
|
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
|
-
### Running and Monitoring Solr with Foreman
|
40
|
-
|
41
|
-
You can use [foreman](http://blog.daviddollar.org/2011/05/06/introducing-foreman.html) to start up and monitor the blacklight rails app and the solr server. Here is an example Procfile:
|
42
|
-
|
43
|
-
web: bundle exec rails s -p $PORT
|
44
|
-
solr: bash -c "cd ./jetty; java -jar -Djetty.port=$PORT start.jar"
|
45
|
-
|
46
|
-
## Blacklight Configuration
|
47
|
-
|
48
|
-
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).
|
49
|
-
|
50
|
-
The CatalogController includes functionality and templates for searching and displaying documents. The CatalogController needs to be configured so it knows about your Solr fields.
|
51
|
-
|
52
|
-
> 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.
|
53
|
-
|
54
|
-
### default_solr_params
|
55
|
-
|
56
|
-
The default_solr_params are parameters that will be sent to the Solr API on all search-like requests:
|
57
|
-
|
58
|
-
```ruby
|
59
|
-
config.default_solr_params = {
|
60
|
-
:qt => 'search',
|
61
|
-
:rows => 10
|
62
|
-
}
|
63
|
-
```
|
64
|
-
|
65
|
-
This configuration would send the following for any request to solr:
|
66
|
-
|
67
|
-
```
|
68
|
-
http://localhost:8983/solr/select?qt=search&rows=10
|
69
|
-
```
|
70
|
-
|
71
|
-
While the default_solr_params are useful for rapid development, they are often moved into the Solr request handler for production deployments.
|
72
|
-
|
73
|
-
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:
|
74
|
-
|
75
|
-
```ruby
|
76
|
-
# See SolrHelper#solr_doc_params
|
77
|
-
config.default_document_solr_params = {
|
78
|
-
:qt => 'document',
|
79
|
-
## These are hard-coded in the blacklight 'document' requestHandler
|
80
|
-
# :fl => '*',
|
81
|
-
# :rows => 1
|
82
|
-
# :q => '{!raw f=id v=$id}'
|
83
|
-
}
|
84
|
-
```
|
85
|
-
|
86
|
-
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.
|
87
|
-
|
88
|
-
|
89
|
-
### results views (index and show)
|
90
|
-
|
91
|
-
|
92
|
-
You can configure the fields and labels that are display for search results on the search and document views.
|
93
|
-
|
94
|
-
> Note: these must be STORED fields in the Solr index, and must be returned in the solr response or they will not be displayed.
|
95
|
-
|
96
|
-
There's a set of configuration parameters for the title and Blacklight template handling (discussed elsewhere):
|
97
|
-
|
98
|
-
```ruby
|
99
|
-
# solr field configuration for search results/index views
|
100
|
-
config.index.show_link = 'title_display'
|
101
|
-
config.index.record_display_type = 'format'
|
102
|
-
|
103
|
-
# solr field configuration for document/show views
|
104
|
-
config.show.html_title = 'title_display'
|
105
|
-
config.show.heading = 'title_display'
|
106
|
-
config.show.display_type = 'format'
|
107
|
-
```
|
108
|
-
|
109
|
-
This configuration will use the ```title_display``` Solr field as the link text for each document.
|
110
|
-
|
111
|
-
There's a separate section for the additional fields to display:
|
112
|
-
|
113
|
-
```ruby
|
114
|
-
# [from app/controllers/catalog_controller.rb]
|
115
|
-
# solr fields to be displayed in the index (search results) view
|
116
|
-
# The ordering of the field names is the order of the display
|
117
|
-
config.add_index_field 'title_display', :label => 'Title:'
|
118
|
-
config.add_index_field 'title_vern_display', :label => 'Title:'
|
119
|
-
config.add_index_field 'author_display', :label => 'Author:'
|
120
|
-
config.add_index_field 'author_vern_display', :label => 'Author:'
|
121
|
-
|
122
|
-
# ...
|
123
|
-
# And likewise for the show (single-document) view:
|
124
|
-
|
125
|
-
config.add_show_field 'title_display', :label => 'Title:'
|
126
|
-
config.add_show_field 'title_vern_display', :label => 'Title:'
|
127
|
-
config.add_show_field 'subtitle_display', :label => 'Subtitle:'
|
128
|
-
```
|
129
|
-
|
130
|
-
[[https://github.com/projectblacklight/projectblacklight.github.com/raw/master/images/index_fields.png|frame|alt=Index Fields]]
|
131
|
-
|
132
|
-
#### Linking a value to a facet search
|
133
|
-
|
134
|
-
When rendering the format value in the search results, link the value to a facet search for that value:
|
135
|
-
|
136
|
-
```ruby
|
137
|
-
config.add_index_field 'format', :label => 'Format:', :link_to_search => true
|
138
|
-
```
|
139
|
-
|
140
|
-
Or specify the field to facet against, explicitly:
|
141
|
-
```ruby
|
142
|
-
config.add_index_field 'author_display', :label => 'Author:', :link_to_search => :author_facet
|
143
|
-
```
|
144
|
-
|
145
|
-
More advanced configuration should use a custom helper method (see below) to render an appropriate value.
|
146
|
-
|
147
|
-
#### Using a helper method to render the value
|
148
|
-
|
149
|
-
You can use view helpers to render the Solr values, e.g.:
|
150
|
-
|
151
|
-
```ruby
|
152
|
-
config.add_index_field 'title_vern_display', :label => 'Title:', :helper_method => :my_helper_method
|
153
|
-
```
|
154
|
-
|
155
|
-
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.
|
156
|
-
|
157
|
-
```ruby
|
158
|
-
module ApplicationHelper
|
159
|
-
def my_helper_method args
|
160
|
-
args[:document][args[:field]].upcase
|
161
|
-
end
|
162
|
-
end
|
163
|
-
```
|
164
|
-
|
165
|
-
Your helper method receives hash with (at least) two parameters:
|
166
|
-
|
167
|
-
- :document => the SolrDocument object
|
168
|
-
- :field => the solr field to display
|
169
|
-
|
170
|
-
|
171
|
-
#### Solr hit highlighting
|
172
|
-
|
173
|
-
You can trigger automatic Solr hit highlighting of results:
|
174
|
-
|
175
|
-
```ruby
|
176
|
-
config.add_index_field 'title_vern_display', :label => 'Title:', :highlight => true
|
177
|
-
```
|
178
|
-
|
179
|
-
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.
|
180
|
-
|
181
|
-
You can have Blacklight send the most basic highlighting parameters for you, if you set:
|
182
|
-
|
183
|
-
```ruby
|
184
|
-
config.add_field_configuration_to_solr_request!
|
185
|
-
```
|
186
|
-
|
187
|
-
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.
|
188
|
-
|
189
|
-
### facet fields
|
190
|
-
|
191
|
-
Faceted search allows users to constrain searches by controlled vocabulary items
|
192
|
-
[[https://github.com/projectblacklight/projectblacklight.github.com/raw/master/images/search_facets.png|frame|alt=Search facets in action]]
|
193
|
-
Note that these must be INDEXED fields in the Solr index, and are generally a single token (e.g. a string).
|
194
|
-
|
195
|
-
```ruby
|
196
|
-
# [from app/controllers/catalog_controller.rb]
|
197
|
-
# solr fields that will be treated as facets by the blacklight application
|
198
|
-
# The ordering of the field names is the order of the display
|
199
|
-
config.add_facet_field 'format', :label => 'Format'
|
200
|
-
config.add_facet_field 'pub_date', :label => 'Publication Year'
|
201
|
-
config.add_facet_field 'subject_topic_facet', :label => 'Topic', :limit => 20
|
202
|
-
config.add_facet_field 'language_facet', :label => 'Language', :limit => true
|
203
|
-
```
|
204
|
-
|
205
|
-
### Facet View Helpers
|
206
|
-
|
207
|
-
You can supply a :helper_method argument to configure what you would like displayed for the facet's text, e.g:
|
208
|
-
|
209
|
-
```ruby
|
210
|
-
config.add_facet_field 'format', :label => 'Format', :helper_method => :my_helper_method
|
211
|
-
```
|
212
|
-
|
213
|
-
With the above code Blacklight will pass the facet's value into the given helper method, with which you can do anything you'd like.
|
214
|
-
|
215
|
-
```ruby
|
216
|
-
module ApplicationHelper
|
217
|
-
def my_helper_method value
|
218
|
-
value.upcase
|
219
|
-
end
|
220
|
-
end
|
221
|
-
```
|
222
|
-
### Facet Queries
|
223
|
-
Blacklight also supports Solr facet queries:
|
224
|
-
|
225
|
-
[[https://github.com/projectblacklight/projectblacklight.github.com/raw/master/images/query_facets.png|frame|alt=Query facets in action]]
|
226
|
-
|
227
|
-
```ruby
|
228
|
-
config.add_facet_field 'pub_date_query', :label => 'Publication Year', :query => {
|
229
|
-
:last_5_years => { :label => 'Last 5 Years', :fq => "[#{Time.now.year-5} TO *]"}
|
230
|
-
}
|
231
|
-
```
|
232
|
-
|
233
|
-
The first argument (which maps to the facet field for plain facets) is used in the Blacklight URL when the facet is selected.
|
234
|
-
|
235
|
-
The :query hash maps 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.
|
236
|
-
|
237
|
-
You can also tell Solr how to sort facets (either by [count or index](http://wiki.apache.org/solr/SimpleFacetParameters#facet.sort)):
|
238
|
-
If your data is strings, you can use this to perform an alphabetical sort of the facets.
|
239
|
-
```ruby
|
240
|
-
config.add_facet_field :my_count_sorted_field, :sort => 'count'
|
241
|
-
config.add_facet_field :my_index_sorted_field, :sort => 'index'
|
242
|
-
```
|
243
|
-
|
244
|
-
|
245
|
-
If you want Solr to add the configured facets and facet queries to the Solr query it sends, you should also add:
|
246
|
-
|
247
|
-
```ruby
|
248
|
-
config.add_facet_fields_to_solr_request!
|
249
|
-
```
|
250
|
-
|
251
|
-
### Date-based facets
|
252
|
-
|
253
|
-
If you have date facets in Solr, you should add a hint to the Blacklight configuration:
|
254
|
-
|
255
|
-
```ruby
|
256
|
-
config.add_facet_field :my_date_field, :date => true
|
257
|
-
```
|
258
|
-
|
259
|
-
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:
|
260
|
-
|
261
|
-
```ruby
|
262
|
-
config.add_facet_field :my_date_field, :date => { :format => :short }
|
263
|
-
```
|
264
|
-
|
265
|
-
### Tagging/Exclusion facets
|
266
|
-
|
267
|
-
From the solr docs:
|
268
|
-
|
269
|
-
> One can tag specific filters and exclude those filters when faceting. This is generally needed when doing multi-select faceting. [...]To implement a multi-select facet for doctype, a GUI may want to still display the other doctype values and their associated counts, as if the doctype:pdf constraint had not yet been applied.
|
270
|
-
>
|
271
|
-
> Example:
|
272
|
-
>
|
273
|
-
> === Document Type ===
|
274
|
-
>
|
275
|
-
> [ ] Word (42)
|
276
|
-
>
|
277
|
-
> [x] PDF (96)
|
278
|
-
>
|
279
|
-
> [ ] Excel(11)
|
280
|
-
>
|
281
|
-
> [ ] HTML (63)
|
282
|
-
|
283
|
-
To configure this behavior in Blacklight,
|
284
|
-
|
285
|
-
```ruby
|
286
|
-
config.add_facet_field :document_type_facet, :tag => 'some-tag', :ex => 'some-tag'
|
287
|
-
```
|
288
|
-
|
289
|
-
### search fields
|
290
|
-
|
291
|
-
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]]
|
292
|
-
[[https://github.com/projectblacklight/projectblacklight.github.com/raw/master/images/search_fields.png|frame|alt=Search fields in action]]
|
293
|
-
|
294
|
-
```ruby
|
295
|
-
# [from app/controllers/catalog_controller.rb]
|
296
|
-
# Now we see how to over-ride Solr request handler defaults, in this
|
297
|
-
# case for a BL "search field", which is really a dismax aggregate
|
298
|
-
# of Solr search fields.
|
299
|
-
|
300
|
-
config.add_search_field('title') do |field|
|
301
|
-
# solr_parameters hash are sent to Solr as ordinary url query params.
|
302
|
-
field.solr_parameters = { :'spellcheck.dictionary' => 'title' }
|
303
|
-
|
304
|
-
# :solr_local_parameters will be sent using Solr LocalParams
|
305
|
-
# syntax, as eg {! qf=$title_qf }. This is neccesary to use
|
306
|
-
# Solr parameter de-referencing like $title_qf.
|
307
|
-
# See: http://wiki.apache.org/solr/LocalParams
|
308
|
-
field.solr_local_parameters = {
|
309
|
-
:qf => '$title_qf',
|
310
|
-
:pf => '$title_pf'
|
311
|
-
}
|
312
|
-
end
|
313
|
-
```
|
314
|
-
|
315
|
-
### sort fields
|
316
|
-
|
317
|
-
```ruby
|
318
|
-
config.add_sort_field 'score desc, pub_date_sort desc, title_sort asc', :label => 'relevance'
|
319
|
-
config.add_sort_field 'pub_date_sort desc, title_sort asc', :label => 'year'
|
320
|
-
config.add_sort_field 'author_sort asc, title_sort asc', :label => 'author'
|
321
|
-
config.add_sort_field 'title_sort asc, pub_date_sort desc', :label => 'title'
|
322
|
-
```
|
323
|
-
|
324
|
-
[[https://github.com/projectblacklight/projectblacklight.github.com/raw/master/images/sort_fields.png|frame|alt=Sort fields in action]]
|
325
|
-
|
326
|
-
> TODO
|
327
|
-
|
328
|
-
## Solr Document
|
329
|
-
|
330
|
-
|
331
|
-
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`:
|
332
|
-
|
333
|
-
```ruby
|
334
|
-
class SolrDocument
|
335
|
-
include Blacklight::Solr::Document
|
336
|
-
|
337
|
-
# self.unique_key = 'id'
|
338
|
-
...
|
339
|
-
end
|
340
|
-
```
|
341
|
-
|
342
|
-
If, for instance, your unique key field was 'uuid_s', this would read:
|
343
|
-
|
344
|
-
```ruby
|
345
|
-
class SolrDocument
|
346
|
-
include Blacklight::Solr::Document
|
347
|
-
|
348
|
-
self.unique_key = 'uuid_s'
|
349
|
-
...
|
350
|
-
end
|
351
|
-
```
|
352
|
-
|
353
|
-
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.
|
354
|
-
|
355
|
-
Also in SolrDocument is a set of "field semantics", which may be used in some basic metadata mapping:
|
356
|
-
|
357
|
-
```ruby
|
358
|
-
class SolrDocument
|
359
|
-
...
|
360
|
-
|
361
|
-
field_semantics.merge!(
|
362
|
-
:title => "title_display",
|
363
|
-
:author => "author_display",
|
364
|
-
:language => "language_facet",
|
365
|
-
:format => "format"
|
366
|
-
)
|
367
|
-
end
|
368
|
-
```
|
369
|
-
|
370
|
-
### Field Collapsing
|
371
|
-
|
372
|
-
Blacklight 4.4 adds support for Solr Field Collapsing (aka results grouping). The initial implementation requires you to explicitly configure your solr request handler (or default solr parameters) to enable grouping.
|
373
|
-
|
374
|
-
Here are some solr request parameters to enable grouping on our demo index:
|
375
|
-
|
376
|
-
```
|
377
|
-
:group => true,
|
378
|
-
:'group.field' => 'pub_date_sort',
|
379
|
-
:'group.ngroups' => true, # group.ngroups is REQUIRED.
|
380
|
-
:'group.limit' => 3
|
381
|
-
```
|
382
|
-
|
383
|
-
If you only define a single group.field, Blacklight will detect the grouped response and use it. If there are multiple fields defined, you have to configure Blacklight to detect the correct field, e.g.:
|
384
|
-
|
385
|
-
```
|
386
|
-
config.index.group = "pub_date_sort"
|
387
|
-
```
|
388
|
-
|
389
|
-
### Thumbnails in results display
|
390
|
-
|
391
|
-
Blacklight 4.4+ can render a representative thumbnail with a result on the search index page.
|
392
|
-
|
393
|
-
Blacklight can pull a URL to the thumbnail from a field in Solr:
|
394
|
-
|
395
|
-
```ruby
|
396
|
-
configure_blacklight do |config|
|
397
|
-
config.index.thumbnail_field = :some_field_in_the_document
|
398
|
-
end
|
399
|
-
```
|
400
|
-
|
401
|
-
Or using custom logic in a helper method of your own creation:
|
402
|
-
|
403
|
-
```ruby
|
404
|
-
configure_blacklight do |config|
|
405
|
-
config.index.thumbnail_method = :xyz
|
406
|
-
end
|
407
|
-
```
|
408
|
-
|
409
|
-
With this configuration, the helper method `xyz` will be called with the `SolrDocument` document and a hash of caller-supplied image options.
|
410
|
-
|
411
|
-
Given that configuration, Blacklight will render a thumbnail (by default, right aligned, under the bookmark button) as a link to the document page. If no thumbnail is available (missing data in solr, the thumbnail method returned nil), the thumbnail block is not displayed at all.
|