blacklight 3.8.1 → 3.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/.travis.yml +14 -0
  2. data/VERSION +1 -1
  3. data/app/controllers/bookmarks_controller.rb +2 -0
  4. data/app/models/solr_document.rb +5 -0
  5. data/app/views/_user_util_links.html.erb +2 -0
  6. data/app/views/catalog/_bookmark_control.html.erb +1 -1
  7. data/doc/Atom-Responses.md +90 -0
  8. data/doc/Blacklight-3.2-Release-Notes-and-Upgrade-Guide.md +191 -0
  9. data/doc/Blacklight-3.3-release-notes-and-upgrade-guide.md +37 -0
  10. data/doc/Blacklight-3.4-release-notes-and-upgrade-guide.md +27 -0
  11. data/doc/Blacklight-3.5-release-notes-and-upgrade-guide.md +44 -0
  12. data/doc/Blacklight-3.6-release-notes-and-upgrade-guide.md +25 -0
  13. data/doc/Blacklight-3.7-release-notes-and-upgrade-guide.md +78 -0
  14. data/doc/Blacklight-3.8-release-notes-and-upgrade-guide.md +11 -0
  15. data/doc/Blacklight-Add-ons.md +28 -0
  16. data/doc/Blacklight-configuration.md +301 -0
  17. data/doc/Blacklight-on-Heroku.md +135 -0
  18. data/doc/Community-principles.md +44 -0
  19. data/doc/Configuring-and-Customizing-Blacklight.md +271 -0
  20. data/doc/Contributing-to-Blacklight.md +25 -0
  21. data/doc/Examples.md +62 -0
  22. data/doc/Extending-or-Modifying-Blacklight-Search-Behavior.md +141 -0
  23. data/doc/Home.md +77 -0
  24. data/doc/How-to-release-a-version.md +37 -0
  25. data/doc/Indexing-your-data-into-solr.md +5 -0
  26. data/doc/Integration-with-Rails-Footnotes.md +20 -0
  27. data/doc/Pagination.md +38 -0
  28. data/doc/Providing-your-own-view-templates.md +109 -0
  29. data/doc/Quickstart.md +116 -0
  30. data/doc/README.md +77 -0
  31. data/doc/README_SOLR.md +245 -0
  32. data/doc/Release-Notes-And-Upgrade-Guides.md +14 -0
  33. data/doc/Sunspot-for-indexing.md +46 -0
  34. data/doc/User-Authentication.md +60 -0
  35. data/doc/testing.md +115 -0
  36. data/lib/blacklight/controller.rb +4 -1
  37. data/lib/generators/blacklight/blacklight_generator.rb +2 -1
  38. data/lib/solrmarc.log.1 +849 -0
  39. data/test_support/bin/test.sh +3 -1
  40. data/test_support/features/record_view.feature +0 -1
  41. data/test_support/features/search.feature +0 -1
  42. data/test_support/features/step_definitions/error_steps.rb +1 -1
  43. data/test_support/features/step_definitions/general_steps.rb +1 -1
  44. data/test_support/features/step_definitions/search_facets_steps.rb +7 -7
  45. data/test_support/features/step_definitions/search_steps.rb +2 -2
  46. data/test_support/spec/{requests → features}/alternate_controller_spec.rb +0 -0
  47. data/test_support/spec/helpers/blacklight_helper_spec.rb +5 -5
  48. metadata +37 -5
@@ -0,0 +1,25 @@
1
+ # Contributing to Blacklight
2
+ Blacklight is a collaborative open source project by developers at various institutions, which we each work on largely motivated by our own local institutions' needs. We work on the shared project together so we can benefit from each other's code, but most developers primary priorities are to their own local development. In this it is like many such projects.
3
+
4
+ The Blacklight developers do want to create a product that is easy for newcomers to install and get started with -- both as a service to the community and in the interests of our own institutions in creating a sustainable project and product that continue to thrive through personnel changes. However, the developers may not always have time to find or fix bugs that may be affecting you, or lead you through every detail of getting Blacklight to work for you.
5
+
6
+ But we do try when we can -- please don't be scared to ask a question on the [[Blacklight mailing list|http://groups.google.com/group/blacklight-development]], just don't be shocked if we can't always give you the answer you want. We always welcome patch submissions; and we are always excited to hear about what others are doing with Blacklight. We're also always looking for more committers, although we usually like to see a patch or two before considering granting committer status.
7
+
8
+ If you follow this short guide, it will make it much easier for the community to review your changes, and the core team to get them included in the next release. If you are new to Git, be sure to read Github's (really good) [[step-by-step directions|http://help.github.com/fork-a-repo/]] for contributing to projects. If you want a basic introduction to git, check out [[Git Reference|http://gitref.org/]].
9
+
10
+ We also encourage a lot of peripheral functionality -- especially for features that may not be used by most implementations, as the Blacklight install base has a wide range of users -- to consider developing stand-alone, optional [[Blacklight add-ons]].
11
+
12
+ ## Adding a ticket
13
+ Let us know you're interested in working on a feature by filing a ticket in our [[issue tracker|https://github.com/projectblacklight/blacklight/issues]].
14
+
15
+ ## Making Your Changes
16
+
17
+ * Fork the project (Github has really good step-by-step directions
18
+ * Start a feature/bugfix branch
19
+ * Commit and push until you are happy with your contribution
20
+ * Make sure to add tests for it. This is important so we don't break it in a future version unintentionally.
21
+ * After making your changes, be sure to run the [[Blacklight rspec and cucumber tests|Testing]] to make sure everything works.
22
+ * Submit your change as a [[Pull Request|http://help.github.com/pull-requests/]].
23
+
24
+ ## Support
25
+ If you are interested in working on the Blacklight plugin, but want guidance or support, please send an email to our [[Blacklight-development mailing list|http://groups.google.com/group/blacklight-development]] and we'll be glad to help.
data/doc/Examples.md ADDED
@@ -0,0 +1,62 @@
1
+ You can see a demonstration of the generic Blacklight plugin at http://demo.projectblacklight.org
2
+
3
+ Columbia University:
4
+
5
+ * Academic Commons (Institutional Repository) - http://academiccommons.columbia.edu/
6
+ * New Arrivals (Subset of OPAC) - http://newarrivals.cul.columbia.edu
7
+ * Staff Collection Viewer (Internal only)
8
+ * CLIO Beta (opac replacement + metasearch) - http://cliobeta.columbia.edu
9
+
10
+ Agriculture Network Information Center
11
+ http://www.agnic.org/search
12
+
13
+ Historical State (NCSU Libraries)
14
+ http://historicalstate.lib.ncsu.edu
15
+
16
+ Johns Hopkins University Libraries (Catalyst)
17
+ http://catalyst.library.jhu.edu
18
+
19
+ Northwest Digital Archives
20
+ http://nwda.projectblacklight.org
21
+
22
+ Northwestern University Library Archival and Manuscript Collections
23
+ http://findingaids.library.northwestern.edu
24
+
25
+ NRM (Natural Resource Management) knowledge online
26
+ http://nrmonline.nrm.gov.au/
27
+
28
+ Rock & Roll Hall of Fame
29
+ http://catalog.rockhall.com/
30
+
31
+ Stanford University
32
+ http://searchworks.stanford.edu
33
+
34
+ University of Virginia
35
+ http://search.lib.virginia.edu
36
+
37
+ University of Wisconsin-Madison
38
+ http://forward.library.wisconsin.edu/
39
+
40
+ United States Holocaust Memorial Museum
41
+ (Currently internal only; public instance soon)
42
+
43
+ WGBH Open Vault
44
+ http://openvault.wgbh.org
45
+
46
+ NCSU Libraries' Digital Collections: Rare and Unique Materials
47
+ http://d.lib.ncsu.edu/collections/
48
+
49
+ University of Hull:
50
+
51
+ * Institutional repository - http://hydra.hull.ac.uk
52
+ * Library catalogue prototype - http://blacklight.hull.ac.uk/
53
+
54
+ The UI component of the Hydra Framework - http://projecthydra.org
55
+
56
+ The New York Public Library
57
+
58
+ * Andre Studios 1930-1941 - http://andrestudios.nypl.org
59
+
60
+ ## Media/Presentations
61
+
62
+ * ["Highly Relevant Search Result Ranking for Large Law Enforcement Information Sharing Systems"](http://www.lucidimagination.com/blog/2011/06/01/solr-and-law-enforcement-highly-relevant-results-can-be-a-crime/), presented by Ronald Mayer of Forensic Logic at Lucene Revolution 2011 - Blacklight was used to quickly provide a proof-of-concept on law enforcement data.
@@ -0,0 +1,141 @@
1
+ # Extending or Modifying Blacklight Search Behavior
2
+
3
+ Solr parameters used by for a given request can come from several different places.
4
+
5
+ * Solr request handler: `solrconfig.xml` in your solr config
6
+ * Application logic: logic in the BL rails app itself
7
+
8
+ ## Solr request handler
9
+
10
+ The Solr [[Request Handlers|http://wiki.apache.org/solr/SolrRequestHandler]] may be configured in the [[solrconfig.xml|http://wiki.apache.org/solr/SolrConfigXml]] and are baked into the request handler itself. Depending on how you have blacklight configured, your app may be using the same Solr request handler for all searches, or may be using different request handlers for different "search fields".
11
+
12
+ The request handler is often set up with default parameters:
13
+
14
+ ```xml
15
+ <requestHandler name="standard" class="solr.SearchHandler" >
16
+ <lst name="defaults">
17
+ <str name="echoParams">explicit</str>
18
+ <str name="rows">10</str>
19
+ <str name="fl">*</str>
20
+ <str name="facet">true</str>
21
+ <str name="facet.mincount">1</str>
22
+ <str name="facet.limit">30</str>
23
+ <str name="facet.field">access_facet</str>
24
+ <str name="facet.field">author_person_facet</str>
25
+ <str name="facet.field">author_other_facet</str>
26
+ <str name="facet.field">building_facet</str>
27
+ <str name="facet.field">callnum_1_facet</str>
28
+ <str name="facet.field">era_facet</str>
29
+ <str name="facet.field">format</str>
30
+ <str name="facet.field">geographic_facet</str>
31
+ <str name="facet.field">language</str>
32
+ <str name="facet.field">pub_date_group_facet</str>
33
+ <str name="facet.field">topic_facet</str>
34
+ </lst>
35
+ </requestHandler>
36
+ ```
37
+ ## Configuration
38
+
39
+ The default application logic (explained below) looks in configuration for things like the name of a the solr request handler to use, and default request parameters to send on every solr search request (or with every request from a certain blacklight search type/field). An example getting started configuration is generally installed into your app when you install Blacklight at `[[./app/controllers/catalog_controller.rb|https://github.com/projectblacklight/blacklight/blob/master/lib/generators/blacklight/templates/catalog_controller.rb]]`.
40
+
41
+ ## Application logic
42
+
43
+ The logic Blacklight uses to determine how to map user-supplied parameters into Solr request parameters for a given application request is in the [[#solr_search_params method in the SolrHelper module|https://github.com/projectblacklight/blacklight/blob/master/lib/blacklight/solr_helper.rb#L76]]. Note that `[[CatalogController|https://github.com/projectblacklight/blacklight/blob/master/app/controllers/catalog_controller.rb]]` extends `[[SolrHelper|https://github.com/projectblacklight/blacklight/blob/master/lib/blacklight/solr_helper.rb]]`, so the `SolrHelper` methods become available in the `CatalogController` (and other controllers, if they extend `SolrHelper` too).
44
+
45
+ Behind the scenes, #solr_search_params uses the `class_inheritable_accessor` method [[solr_search_params_logic|https://github.com/projectblacklight/blacklight/blob/master/lib/blacklight/solr_helper.rb#L30]]. solr_search_params_logic is essentially a class variable that is mixed into the CatalogController and provides an ordered list of methods to call that may inspect the supplied user parameters and add, remove, or modify the Solr request parameters that will be sent to an [[RSolr|https://github.com/mwmitchell/rsolr/]] object, which in turn will convert the hash into query parameters for a Solr request. One confusing thing is that RSolr and [[RSolr-ext|https://github.com/mwmitchell/rsolr-ext]] provide their own mappings from certain custom terms to Solr-recognized request parameters. For instance, a `:per_page` key in that hash will get mapped to the Solr `&rows` parameter -- but a `:rows` key will also. Blacklight developers have found that using these special RSolr "aliases" leads to confusion, as well as confusing bugs (if both `:per_page` and `:rows` are set in the hash, what happens can be hard to predict). So we try to avoid using the special RSolr aliases, and just use ordinary Solr parameters in our hashes. But you may encounter older code that uses the RSolr aliases.
46
+
47
+ There can be similar confusing behavior or bugs if one piece of code adds a key to a `Hash` using a `Symbol`, but another piece of code looks for and/or adds that same key to the `Hash` using a `String` instead. RSolr happens to accepts either one, but if both are present RSolr behavior can be unexpected. And even before it gets to RSolr, you may have code that thinks it replaced a key but did not becuase it was using the wrong form. Blacklight developers have agreed to try and always use `Symbol` based keys in hashes meant for Solr parameters, to try and avoid these problems. Longer term, we could probably make some code changes to make this kind of error less likely.
48
+
49
+ The default `#solr_search_params_logic` is meant to handle very common cases and patterns based on simple configuration options from the controller and the user-supplied URL parameters.
50
+
51
+ * `[[blacklight_config.default_solr_params|https://github.com/projectblacklight/blacklight/blob/master/lib/generators/blacklight/templates/catalog_controller.rb#L9]]`
52
+ * Default params sent to solr with every search, including the default :qt param, which determines which Solr request handler will be targetted. Some people like to use solrconfig.xml request handler defaults exclusively, and include only a :qt here; others find it more convenient to specify some defaults at the application level here.
53
+ * `[[blacklight_config.search_fields|https://github.com/projectblacklight/blacklight/blob/master/lib/generators/blacklight/templates/catalog_controller.rb#L81]]`
54
+ * Each search field will be presented in a select menu in the BL user interface search box. These 'search fields' don't neccesarily correspond 1-to-1 with Solr fields. What they instead correspond to is Solr parameter over-rides that will be used for this BL UI search field. Those over-rides are present here.
55
+ * You could simply chose a different `:qt` Solr request handler for each search field, which has it's own default parameters in the sorlconfig.xml. This is what we started out doing with Solr, but found it led to much duplication of information in solrconfig.xml.
56
+ * You can continue using the same Solr request handler, but simply specify different parameters which will be included in the http query string sent to Solr here, with the `:solr_parameters` key. This works fine, but some people don't like how it makes your Solr requests much longer/more complex in the Solr logs; and/or they prefer to control this Solr side instead of Application side.
57
+ * For the best of both worlds, although it's a bit confusing at first, you can use the `:solr_local_parameters` key to have parameters supplied to Solr using the Solr [[LocalParams|http://wiki.apache.org/solr/LocalParams]] syntax, which means you can use "parameter dereferencing" with dollar-sign-prefixed references to variables defined in solrconfig.xml request handler. This is what the current example BL setup does.
58
+
59
+ So the default implementation of `#solr_search_params` takes these configured parameters, combines them with certain query parameters from the current users HTTP request to the BL app, and prepares a Hash of parameters that will be sent to solr. For common use patterns, this is all you need.
60
+
61
+ But sometimes you want to add some custom logic to `#solr_search_params` to come up with the solr params Hash in different ways. Typically to support a new UI feature of some kind, either in your local app or in a Blacklight add-on plugin you are developing.
62
+
63
+
64
+ # Extending Blacklight::SolrHelper#solr_search_params
65
+
66
+ To add new search behaviors (e.g. authorization controls, pre-parsing query strings, etc), the easiest route is to add additional steps to the `#solr_search_params_logic`, either at the beginning of the list (to set default parameters) or at the end of the list (to force particular parameters). Because `#solr_search_params_logic` is just an ordinary array, you may perform any normal array operation (e.g. push/pop/delete/insert) to customize the parameter generation to meet your needs.
67
+
68
+ `#solr_search_params_logic` steps take two inputs, the hash of `solr_parameters` and the hash of `user_parameters` (often provided by the URL parameters), and modifies the `solr_parameters` directly, as needed.
69
+
70
+ You can add custom solr_search_params_logic steps within your controller (or in many other places, including initializers, mixins, etc) by adding a Symbol with the name of a method (provided by the controller) you wish to use, e.g.:
71
+
72
+ *./config/initializers/blacklight_config.rb*
73
+
74
+ ```ruby
75
+ class CatalogController
76
+ self.solr_search_params_logic += :show_only_public_records
77
+ end
78
+ ```
79
+ The controller must provide the method added to `solr_search_params_logic`, in this case `show_only_public_records`. It is often convenient to do this in a separate `Module` and include it into the controller:
80
+
81
+ *./app/controllers/catalog_controller.rb*
82
+
83
+ ```ruby
84
+ require 'blacklight/catalog'
85
+ class CatalogController < ApplicationController
86
+ include Blacklight::Catalog
87
+ include MyApplication::SolrHelper::Authorization
88
+
89
+ # Instead of defining this within an initializer, you may instead wish to do it on the controller directly:
90
+ # self.solr_search_params_logic << :show_only_public_records
91
+
92
+ # You could also define the actual method here, but this is not recommended.
93
+ # def show_only_public_records solr_parameters, user_parameters
94
+ # [...]
95
+ # end
96
+ end
97
+ ```
98
+
99
+ The included module then defines the logic method:
100
+
101
+ *./lib/my_application/solr_helper/authorization.rb*
102
+
103
+ ```ruby
104
+ module MyApplication::SolrHelper::Authorization
105
+ # You could also add the logic here
106
+ # def self.included base
107
+ # base.solr_search_params_logic << :show_only_public_records
108
+ # end
109
+
110
+ # solr_search_params_logic methods take two arguments
111
+ # @param [Hash] solr_parameters a hash of parameters to be sent to Solr (via RSolr)
112
+ # @param [Hash] user_parameters a hash of user-supplied parameters (often via `params`)
113
+ def show_only_public_records solr_parameters, user_parameters
114
+ # add a new solr facet query ('fq') parameter that limits results to those with a 'public_b' field of 1
115
+ solr_parameters[:fq] ||= []
116
+ solr_parameters[:fq] << 'public_b:1'
117
+ end
118
+ end
119
+ ```
120
+
121
+ ## Other examples
122
+
123
+ In addition to providing this behavior locally, some Blacklight plugins also extend the `#solr_search_params`:
124
+
125
+ * [[Blacklight Range Limit|https://github.com/projectblacklight/blacklight_range_limit/blob/master/lib/blacklight_range_limit/controller_override.rb]]
126
+
127
+ * A walk through on adding a checkbox limit at: http://bibwild.wordpress.com/2011/06/13/customing-blacklight-a-limit-checkbox/
128
+
129
+ * A much more complicated walk-through on adding an 'unstemmed search' checkbox limit: http://bibwild.wordpress.com/2011/06/20/customizing-blacklight-disable-automatic-stemming/
130
+
131
+ ## Suppressing search results
132
+
133
+ You can configure your `solrconfig.xml` to not show results based on fields in your solr document. For example, if you have a solr boolean field such as `show_b`, you can suppress any records that have this field present. To do so, add:
134
+ ```
135
+ <lst name="appends"><str name="fq">-show_b:["" TO *]</str></lst>
136
+ ```
137
+ to the request handler in your `solrconfig.xml` file. If you would like this to be for standard solr searches, add the above line to this request handler:
138
+ ```
139
+ <requestHandler name="search" class="solr.SearchHandler" default="true">
140
+ ```
141
+ By doing so, solr queries that use the "document" request handler will still give you any records with the show_b field, but solr queries with the "search" handler will not.
data/doc/Home.md ADDED
@@ -0,0 +1,77 @@
1
+ #
2
+ [[https://github.com/projectblacklight/projectblacklight.github.com/raw/master/images/logo.png]]
3
+
4
+ ## Introduction
5
+
6
+ Blacklight is an open source, Ruby on Rails engine/gem that provides a discovery interface for [Apache Solr](http://lucene.apache.org/solr). Blacklight provides a basic user interface with a search box, facet constraints, stable document urls, etc., all of which is customizable via Rails (templating) mechanisms. Blacklight accommodates heterogeneous data, allowing different information displays for different types of objects.
7
+
8
+ Some other features include:
9
+
10
+ * Stable URLs for search and record pages allow users to bookmark, share, and save search queries for later access
11
+ * Every Blacklight search provides RSS and Atom Responses of search results
12
+ * For certain types of solr documents, an OpenURL/Z39.88 COinS object is embedded in each document, which allows plugins like Zotero to easily extract data from the page.
13
+ * Blacklight supports OpenSearch, a collection of simple formats for the sharing of search results.
14
+ * Faceted searching
15
+ * Search queries can be targeted at specific sets of fields
16
+ * Results sorting
17
+ * Tools for exporting records to Refworks or Endnote, sending records via Email or SMS, or as a formatted citation.
18
+
19
+ A [demo application](http://demo.projectblacklight.org) uses the latest version of Blacklight to display a basic library catalog.
20
+
21
+ > NOTE: This wiki provides developer documentation for the latest Blacklight release. For documentation of older releases, see the end of this page.
22
+
23
+ ## Getting Started
24
+ * [[Quickstart Guide|Quickstart]]
25
+ * [[Site Search|http://projectblacklight.org/search.html]]
26
+ * [[Demo|http://demo.projectblacklight.org]]
27
+ * [[Example installations|Examples]]
28
+ * [[Release Notes And Upgrade Guides]]
29
+
30
+
31
+ ## Developing your application
32
+ * [[Blacklight Configuration]]: Search results, facets, query fields
33
+ * [[Providing your own view templates]]: Overriding the out-of-the-box Blacklight templates the Rails way.
34
+ * [[User Authentication]]: Connecting Blacklight with an existing Authentication system
35
+ * [[Extending or Modifying Blacklight Search Behavior]] How to change the way the Blacklight discovery feature works.
36
+ * [[Internationalization]]: Translating (or simply customizing) the Blacklight copy
37
+ * [[Common Blacklight Patterns]]
38
+ * [[Indexing your data into Solr]]
39
+ * [[Additional Blacklight-specific Solr documentation|README_SOLR]]
40
+ * [[Blacklight on Heroku]]
41
+ * [[Pagination]]: Advise on how to customize pagination with Kaminari
42
+
43
+
44
+ ## Support
45
+ Don't be scared to ask a question on the [[Blacklight mailing list|http://groups.google.com/group/blacklight-development]]. We appreciate you checking the documentation first and asking an educated question, but don't beat your head against the wall -- sometimes the existing documentation may be out of date and inaccurate.
46
+
47
+ In order to reduce spam, the first time you post your email will be held in a moderation queue, but as soon as your first message is approved your posts won’t be held for moderation any longer.
48
+
49
+ Some Blacklight developers aso hang out on our IRC channel, usually during North American office hours. On `chat.freenode.net`, channel `#blacklight`. Stop in and say hi, we're happy to help with questions when we have time. [[http://freenode.net/faq.shtml]].
50
+
51
+ * [[Bug Tracker|https://github.com/projectblacklight/blacklight/issues/]]
52
+ * [[Mailing List|http://groups.google.com/group/blacklight-development]]
53
+ * [[Jenkins Continuous Integration|http://hudson.projectblacklight.org]]
54
+
55
+ ## Contributing to Blacklight
56
+
57
+ * [[Contributing to Blacklight]]
58
+ * [[Community Principles]]
59
+ * [[How to release a version]]
60
+ * [[Testing]]
61
+
62
+ ## Releases
63
+ Blacklight releases are published on the [[Rubygems.org blacklight project|https://rubygems.org/gems/blacklight]].
64
+
65
+ For a list of features and bugfixes in Blacklight releases, see the [[Release announcements|Release Notes And Upgrade Guides]] on this wiki.
66
+
67
+ ### Older Documentation
68
+ This wiki provides developer documentation for the ```master``` branch of Blacklight, which may include documentation of features not present in every Blacklight version. For documentation of specific Blacklight releases, see also:
69
+
70
+ * [[Home]]
71
+ * [[Blacklight 3.x|https://github.com/projectblacklight/blacklight/tree/release-3.8/doc]]
72
+ * [[Blacklight 3.0 or 3.1|https://github.com/projectblacklight/blacklight/tree/release-3.1/doc]]
73
+ * [[Blacklight 2.x|https://github.com/projectblacklight/blacklight/tree/v2.9-frozen/doc]] for all Blacklight 2.x releases; version-specific documentation is also available:
74
+ * [[Blacklight 2.7|https://github.com/projectblacklight/blacklight/tree/v2.7.0/doc]]
75
+ * [[Blacklight 2.6|https://github.com/projectblacklight/blacklight/tree/v2.6.0/doc]]
76
+ * [[Blacklight 2.5|https://github.com/projectblacklight/blacklight/tree/v2.5.0/doc]]
77
+ * [[Blacklight 2.4|https://github.com/projectblacklight/blacklight/tree/v2.4.2/doc]]
@@ -0,0 +1,37 @@
1
+ Before releasing, ensure that you're on the master branch. Run all tests and ensure that they pass. Also check the [[hudson site|http://hudson.projectblacklight.org/hudson/]] to make sure tests are passing.
2
+ ```bash
3
+ $ ./test_support/bin/test.sh
4
+ ```
5
+
6
+ 1. Create a release branch, wit the format release-{major}.{minor}
7
+ ```bash
8
+ $ git checkout -b release-{major}.{minor}
9
+ # Switched to a new branch 'release-{major}.{minor}'
10
+ ```
11
+
12
+ 1. Update the version number in ./VERSION
13
+ ```
14
+ {major}.{minor}.{patch}
15
+ ```
16
+
17
+ 1. Update the links in the readme files to point at the correct version so we're not linking to the documents in master which may not be correct for the specific tagged release (change "master" to version number)
18
+
19
+ 1. Fix GitHub issue tracker to know about the release
20
+ * Create a milestone in GitHub for the NEXT version.
21
+ * Move any open tickets for released version to the next version.
22
+ * Mark the milestone as released.
23
+
24
+ 1. Write an upgrade guide for [[Release Notes And Upgrade Guides]].
25
+
26
+ 1. Prepare announcement
27
+ * Include URL to GitHub closed issues for version
28
+ * Include URL to github commits between tags. github can show all commits between two versions with a URL of this form: [[http://github.com/projectblacklight/blacklight/compare/v2.5.0...v2.6.0]] Replace with previous version and current release version tags.
29
+ * Include URL to the Github wiki [[Release Notes And Upgrade Guides]].
30
+
31
+ 1. Release the gem
32
+ ```bash
33
+ $ rake release
34
+ ```
35
+
36
+ 1. Announce
37
+ * Write emails announcing the release to Blacklight Development
@@ -0,0 +1,5 @@
1
+ Blacklight uses Solr as its data index. Blacklight is agnostic as to how that Solr index gets populated. Many Blacklight contributors work in university libraries and have to deal with library data in the MARC format. The Blacklight out-of-the-box demo and test suite is geared towards that use case.
2
+
3
+ ## What’s the relationship between Blacklight and SolrMarc?
4
+
5
+ However, one excellent way to index lots of MARC records into Solr quickly is to use SolrMarc. Some of the same people are active in both projects, e.g, Bob Haschart from UVA and Naomi Dushay from Stanford University. SolrMarc is not a Blacklight-specific project, it is also used by VuFind and other projects, and is a separate project that exists in its own right.
@@ -0,0 +1,20 @@
1
+ [[Rails Footnotes|https://github.com/josevalim/rails-footnotes]] is a helpful plugin that displays footnotes in your application for easy debugging, such as sessions, request parameters, cookies, filter chain, routes, queries, etc. Installing Rails Footnotes is very easy, just add this to your Gemfile:
2
+ ```ruby
3
+ gem 'rails-footnotes', '>= 3.7', :group => :development
4
+ ```
5
+
6
+ And add something like this to config/initializers/footnotes.rb to run the Footnotes plugin:
7
+ ```ruby
8
+ if defined?(Footnotes) && Rails.env.development?
9
+ Footnotes.run!
10
+ end
11
+ ```
12
+
13
+ To add RSolr debugging information to the footnotes panel, you can use the [[RSolr Footnotes|https://github.com/cbeer/rsolr-footnotes]] gem by adding this to your Gemfile:
14
+ ```ruby
15
+ gem "rsolr-footnotes", :group => :development
16
+ ```
17
+
18
+ RSolr footnotes will capture every solr request with basic performance information and provide a link back to the Solr request URL.
19
+
20
+ [[https://github.com/projectblacklight/projectblacklight.github.com/raw/master/images/rsolr_footnotes_example.png|frame|alt=Example of RSolr Footnotes in the Blacklight Demo App]]
data/doc/Pagination.md ADDED
@@ -0,0 +1,38 @@
1
+ Blacklight uses [kaminari](https://github.com/amatsuda/kaminari) for providing pagination of Solr responses.
2
+
3
+ One motivation for this is so a pagination view theme can be provided that you can use for your custom code with ordinary ActiveRecord or anything else kaminari can handle, to have consistency between the rest of your app's pagination and Blacklight's Solr response pagination.
4
+
5
+ ## How it works
6
+
7
+ The Blacklight #paginate_params helper method takes an RSolr::Response, and converts it to something Kaminari #paginate can handle. (Basically just by translating some attribute names). So you could call:
8
+
9
+ paginate( paginate_params(@response) ) # where @response is an RSolr::Response
10
+
11
+ But there's a shortcut Blacklight helper method which compacts this, #paginate_rsolr_response:
12
+
13
+ paginate_solr_response @response, :theme => 'blacklight'
14
+
15
+ The `theme => 'blacklight'` part will be passed through kaminari, and tell kaminari to use the theme that the Blacklight plugin supplies at [app/views/kaminari/blacklight](https://github.com/projectblacklight/blacklight/tree/master/app/views/kaminari/blacklight)
16
+
17
+ Any other arguments of ordinary kaminari paginate can also be passed in there. If all client code uses #paginate_solr_response, it also provides a 'hook' for local apps to completely over-ride pagination rendering, perhaps not even using kaminari.
18
+
19
+ Additionally, we sometimes want to output a "Showing X through Y of N" message, which kaminari doesnt' have a way to do by default, so we just provide our own way in a Blacklight view helper method, which takes a RSolr::Response too:
20
+
21
+ render_pagination_info(@response)
22
+
23
+ ## Changing the kaminari theme
24
+
25
+ If you want to change how pagination links are rendered, the easiest/cleanest thing to do is to over-ride the 'blacklight' theme that the Blacklight plugin defines. Copy the view templates in Blacklight source at app/views/kaminari/blacklight to your own local app/views/kaminari/blacklight. You actually only need to copy files you'll want to modify, templates not overridden with a local copy will still be found by kaminari from the Blacklight gem. You can use any techniques available for creating a kaminari theme when editing these files, including over-riding more kaminari view templates if available. See the kaminari documentation.
26
+
27
+ There are other ways you could change how Blacklight pagination renders, but by doing it this way, any code (in core Blacklight or additional plugins you install) that tries to render pagination using kaminari with 'blacklight' theme will get your locally defined theme.
28
+
29
+ The "pagination info" (showing X through Y of N) is not part of the kaminari theme, but just a blacklight view helper method, #render_pagination_info. To change this, just over-ride this method [[over-ride locally|CUSTOMIZING]] like any other Blacklight view helper method.
30
+
31
+ ## Using kaminari theme for your own pagination
32
+
33
+ Your local app may show pagination of ActiveRecord objects, that you'd like to appear consistent with other Blacklight pagination. Just use kaminari to show the pagination HTML, with the theme :blacklight. This technique can be used for anything kaminari can paginate, such as Mongoid et al, in addition to ActiveRecord. Fetch the ActiveRecords using ordinary kaminari techniques (see kaminari docs) and then:
34
+
35
+ paginate @my_active_records, :theme => 'blacklight'
36
+
37
+ That's it. There's currently no great way to display the #render_pagination_info for anything but RSolr::Response.
38
+
@@ -0,0 +1,109 @@
1
+ > TODO: Validate this page for Blacklight 4.x!
2
+
3
+ # Customizing the User Interface
4
+ ## Layouts
5
+
6
+ The built-in Blacklight controllers all by default use a Rails view layout called "blacklight", that lives in the Blacklight source. This ends up being a bit confusing, but is the best way we have at present to have out of the box default using a layout with full functionality, without stepping on a possibly existing local 'application' layout.
7
+
8
+ To change what layout the Blacklight controllers use, simply implement a method #layout_name in your local application_controller.rb that returns the name of the layout you'd like them to use.
9
+
10
+ ```ruby
11
+ # [from app/controllers/application_controller.rb]
12
+ class ApplicationController < ActionController::Base
13
+ ...
14
+ def layout_name
15
+ "application"
16
+ end
17
+ ...
18
+ end
19
+ ```
20
+
21
+ When implementing your own layout instead of using the stock one, you may want to look at the Blacklight app/views/layouts/blacklight.html.erb file to see what helper methods are called there, to maintain full Blacklight functionality you may want to call these same helper methods.
22
+
23
+ * `render_head_content` renders content within the
24
+ html `<head>` tag, which includes document-specific alternative
25
+ formats as well as tags generated by plugins, etc.
26
+ * `sidebar_items` renders features including sidebar content, e.g. facet
27
+ lists.
28
+ * flash messages
29
+ * user util links
30
+
31
+ ## Overriding Views (templates and partials)
32
+ As a Rails Engine, you can easily override views in your app. You can see what views and partials are provided by looking in `[[./app/views|https://github.com/projectblacklight/blacklight/tree/master/app/views]]` inside the Blacklight source.
33
+
34
+ Once you find the view you'd like to change, you should create a file with the same name and relative path in your own application (e.g. if you wanted to override [[./app/views/catalog/_show_partials/_default.html.erb|https://github.com/projectblacklight/blacklight/blob/master/app/views/catalog/_show_partials/_default.html.erb]] you would create ./app/views/catalog/_show_partials/_default.html.erb in your local application. Frequently, you will start by copying the existing Blacklight view and modifying it from there.
35
+
36
+ It is generally recommended that you override as little as possible, in order to maximize your forward compatibility. Look to override either a small, focused partial template, or a helper method of partial template called from a larger template, so your application's version can call out to those same helpers or partial templates within blacklight core code.
37
+
38
+ ## Overriding the CatalogController
39
+ Overriding the Blacklight `CatalogController` implementation is easy, and the skeleton of the `CatalogController` is generated into your application for you when you install Blacklight.
40
+
41
+ See the [[Extending or Modifying Blacklight Search Behavior]] for tips and approaches to customizing the catalog.
42
+
43
+ ## Overriding Other Controllers
44
+
45
+ 1. Find the controller you're interested in blacklight's app/controllers/ .
46
+ 2. Create a file with the same name in your local app/controllers.
47
+ 3. This file requires the original class, and then re-opens it to add more methods.
48
+
49
+ ```ruby
50
+ require "#{Blacklight.controllers_dir}/some_controller"
51
+
52
+ class SomeController < ApplicationController
53
+ # custom code goes here
54
+ end
55
+ ```
56
+
57
+ In that "custom code goes here", you can redefine certain methods (action methods or otherwise) to do something different. You can also add new methods (again action methods or otherwise), etc.
58
+
59
+ It's kind of hard to call 'super' to call original functionality:
60
+
61
+ * the ruby language features here make 'super' unavailable, although you can work around that confusingly with the rails #alias_method_chain method.
62
+ * but more importantly, action methods in particular don't really suit themselves to being over-ridden and called by super, because the original implementation often does something you'd want to change but there's no easy way to 'undo' -- calling 'render', which can only be called once.
63
+
64
+ So basically, if you find yourself wanting to access some functionaltiy in the original implementation of a method that you also want to over-ride -- the best solution is probably to refactor Blacklight core code to put that functionality in a subsidiary method, so you can over-ride the action method entirely but call that logic from core. Action methods should be short and sweet anyway.
65
+
66
+
67
+ ## Custom View Helpers
68
+
69
+ (This is accurate for Blacklight 3.1.1 and subsequent. Before that, things were messier).
70
+
71
+ One of the most common things you might need to do is create a view helper -- especially to override some Blacklight behavior implemented in it's own view helpers. The first step is looking at Blacklight source to determine what view helper method you want to override.
72
+
73
+ Blacklight comes packaged with several view helper modules. There is a BlacklightHelper in (blacklight source) app/helpers/blacklight_helper.rb , and several others that correspond to specific controller. (Note, depending on version of Rails and configuration, all helpers may get loaded for every request, even ones that are named to correspond only to a particular other controller).
74
+
75
+ If you simply created a local helper with the same name as a helper in Blacklight, that will end up preventing the Blacklight helper from being loaded at all though, which is not what you want to do to override.
76
+
77
+ We've structured each Blacklight view helper module into two parts to make it easy to selectively over-ride methods. For instance, here's Blacklight's app/helpers/blacklight_helper.rb:
78
+
79
+ ```ruby
80
+ module BlacklightHelper
81
+ include Blacklight::BlacklightHelperBehavior
82
+ end
83
+ ```
84
+
85
+ Now, the actual methods will be found in app/helpers/blacklight/blacklight_helper_behavior.rb instead.
86
+
87
+ If you want to over-ride a helper method, copy the wrapper blacklight_helper into your local app, with the 'include' line, and now you can individually over-ride methods from BlacklightHelperBehavior, and the other methods you don't over-ride will still have their default implementation.
88
+
89
+ YOUR `app/helpers/blacklight_helper.rb`
90
+
91
+ ```ruby
92
+ module BlacklightHelper
93
+ include Blacklight::BlacklightHelperBehavior
94
+
95
+ def application_name
96
+ "Bestest University Search"
97
+ end
98
+ end
99
+ ```
100
+
101
+ One helper you might want to over-ride for customization is #render_document_partial (currently defined in [[blacklight_helper|https://github.com/projectblacklight/blacklight/blob/master/app/helpers/blacklight_helper.rb]]), which you can over-ride to choose differnet local partial views to display a document on search results or detail page, possibly varying depending on type of document according to your own local logic.
102
+
103
+ ## Adding in your own CSS or Javascript
104
+
105
+ Within your local application, you can use the [[Rails Asset Pipeline|http://guides.rubyonrails.org/asset_pipeline.html]] to manipulate javascript and css documents.
106
+
107
+ **todo??** better instructions for over-riding BL's built in CSS using SASS? (jrochkind thought jamesws wrote such already, but can't find them now)
108
+
109
+ The Blacklight generator added a file to your app at `./app/assets/stylesheets/blacklight_themes/standard.css.scss`, elements of the BL default theme can be customized or over-ridden there. If there's something you want to do but aren't sur e the best way, feel free to ask on the listserv.