blacklight 3.8.2 → 4.0.0.pre6
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/README.md +1 -1
- data/VERSION +1 -1
- data/app/assets/javascripts/blacklight/blacklight.js +12 -1
- data/app/assets/javascripts/blacklight/bootstrap_dropdowns.js +3 -0
- data/app/assets/javascripts/blacklight/checkbox_submit.js +12 -5
- data/app/assets/javascripts/blacklight/core.js +0 -1
- data/app/assets/javascripts/blacklight/css_dropdowns.js +10 -0
- data/app/assets/javascripts/blacklight/facet_expand_contract.js +5 -5
- data/app/assets/javascripts/blacklight/lightbox_dialog.js +68 -13
- data/app/assets/javascripts/blacklight/select_submit.js +19 -10
- data/app/assets/javascripts/improved-modal/bootstrap-modal.js +282 -0
- data/app/assets/javascripts/improved-modal/bootstrap-modalmanager.js +353 -0
- data/app/assets/stylesheets/blacklight/_blacklight_base.css.scss +16 -5
- data/app/assets/stylesheets/blacklight/_bookmark.css.scss +24 -6
- data/app/assets/stylesheets/blacklight/_catalog.css.scss +115 -141
- data/app/assets/stylesheets/blacklight/_dropdown.css.scss +57 -0
- data/app/assets/stylesheets/blacklight/_facets.css.scss +127 -58
- data/app/assets/stylesheets/blacklight/_footer.css.scss +20 -0
- data/app/assets/stylesheets/blacklight/_header.css.scss +90 -21
- data/app/assets/stylesheets/blacklight/_layout.css.scss +10 -9
- data/app/assets/stylesheets/blacklight/_modal.css.scss +23 -0
- data/app/assets/stylesheets/blacklight/_print.css.scss +0 -7
- data/app/assets/stylesheets/blacklight/_responsive.css.scss +3 -0
- data/app/assets/stylesheets/blacklight/_search_history.css.scss +2 -4
- data/app/assets/stylesheets/blacklight/blacklight.css.scss +0 -1
- data/app/assets/stylesheets/blacklight/blacklight_defaults.css.scss +9 -2
- data/app/assets/stylesheets/blacklight/responsive_partials/_catalog.css.scss +5 -0
- data/app/assets/stylesheets/blacklight/responsive_partials/_facets.css.scss +37 -0
- data/app/assets/stylesheets/blacklight/responsive_partials/_header.css.scss +30 -0
- data/app/assets/stylesheets/improved-modal/bootstrap-modal.css +199 -0
- data/app/controllers/bookmarks_controller.rb +16 -10
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +124 -61
- data/app/helpers/blacklight/catalog_helper_behavior.rb +5 -3
- data/app/helpers/blacklight/facets_helper_behavior.rb +9 -9
- data/app/views/_flash_msg.html.erb +9 -4
- data/app/views/_user_util_links.html.erb +23 -17
- data/app/views/bookmarks/_tools.html.erb +7 -7
- data/app/views/bookmarks/index.html.erb +5 -13
- data/app/views/catalog/_bookmark_control.html.erb +2 -4
- data/app/views/catalog/_bookmark_form.html.erb +1 -1
- data/app/views/catalog/_citation.html.erb +21 -20
- data/app/views/catalog/_constraints.html.erb +8 -6
- data/app/views/catalog/_document_header.html.erb +6 -7
- data/app/views/catalog/_document_list.html.erb +1 -7
- data/app/views/catalog/_email_form.html.erb +42 -16
- data/app/views/catalog/_facet_layout.html.erb +1 -1
- data/app/views/catalog/_facet_limit.html.erb +1 -1
- data/app/views/catalog/_facet_pagination.html.erb +11 -14
- data/app/views/catalog/_facets.html.erb +16 -2
- data/app/views/catalog/_home.html.erb +2 -2
- data/app/views/catalog/_home_text.html.erb +5 -2
- data/app/views/catalog/_index_default.html.erb +2 -2
- data/app/views/catalog/_marc_view.html.erb +0 -1
- data/app/views/catalog/_paginate_compact.html.erb +5 -0
- data/app/views/catalog/_per_page_widget.html.erb +13 -7
- data/app/views/catalog/_previous_next_doc.html.erb +14 -4
- data/app/views/catalog/_refworks_form.html.erb +2 -2
- data/app/views/catalog/_results_pagination.html.erb +4 -1
- data/app/views/catalog/_search_form.html.erb +19 -13
- data/app/views/catalog/_show_default.html.erb +2 -2
- data/app/views/catalog/_show_more_like_this.html.erb +3 -0
- data/app/views/catalog/_show_sidebar.html.erb +14 -1
- data/app/views/catalog/_show_tools.html.erb +18 -18
- data/app/views/catalog/_sms_form.html.erb +35 -10
- data/app/views/catalog/_sort_and_per_page.html.erb +5 -3
- data/app/views/catalog/_sort_widget.html.erb +12 -6
- data/app/views/catalog/citation.html.erb +1 -1
- data/app/views/catalog/citation.js.erb +7 -0
- data/app/views/catalog/email.html.erb +5 -0
- data/app/views/catalog/facet.html.erb +28 -21
- data/app/views/catalog/index.html.erb +26 -26
- data/app/views/catalog/librarian_view.html.erb +7 -0
- data/app/views/catalog/show.html.erb +35 -29
- data/app/views/catalog/sms.html.erb +5 -0
- data/app/views/kaminari/blacklight/_first_page.html.erb +2 -2
- data/app/views/kaminari/blacklight/_gap.html.erb +4 -1
- data/app/views/kaminari/blacklight/_last_page.html.erb +2 -2
- data/app/views/kaminari/blacklight/_next_page.html.erb +3 -3
- data/app/views/kaminari/blacklight/_page.html.erb +4 -3
- data/app/views/kaminari/blacklight/_paginator.html.erb +5 -5
- data/app/views/kaminari/blacklight/_prev_page.html.erb +3 -3
- data/app/views/kaminari/blacklight_compact/_next_page.html.erb +9 -0
- data/app/views/kaminari/blacklight_compact/_paginator.html.erb +15 -0
- data/app/views/kaminari/blacklight_compact/_prev_page.html.erb +9 -0
- data/app/views/layouts/blacklight.html.erb +47 -27
- data/app/views/saved_searches/index.html.erb +2 -2
- data/app/views/search_history/index.html.erb +12 -7
- data/app/views/shared/_footer.html.erb +0 -0
- data/app/views/shared/_header_navbar.html.erb +25 -0
- data/blacklight.gemspec +2 -5
- data/config/locales/blacklight.en.yml +23 -15
- data/lib/blacklight.rb +2 -2
- data/lib/blacklight/catalog.rb +36 -14
- data/lib/blacklight/configuration.rb +10 -2
- data/lib/blacklight/mash.rb +151 -0
- data/lib/blacklight/solr/document.rb +73 -11
- data/lib/blacklight/solr/document/extensions.rb +0 -8
- data/lib/blacklight/solr/document/marc_export.rb +7 -2
- data/lib/blacklight/solr/document/more_like_this.rb +5 -0
- data/lib/blacklight/solr_helper.rb +43 -18
- data/lib/blacklight/solr_response.rb +60 -0
- data/lib/blacklight/solr_response/facets.rb +58 -0
- data/lib/blacklight/solr_response/more_like_this.rb +14 -0
- data/lib/blacklight/solr_response/spelling.rb +92 -0
- data/lib/generators/blacklight/assets_generator.rb +1 -14
- data/lib/generators/blacklight/blacklight_generator.rb +22 -21
- data/lib/generators/blacklight/jetty_generator.rb +1 -35
- data/{test_support → lib/generators/blacklight/templates}/alternate_controller.rb +0 -0
- data/lib/generators/blacklight/templates/blacklight.css.scss +4 -0
- data/lib/generators/blacklight/templates/config/SolrMarc/config-test.properties +2 -2
- data/lib/generators/blacklight/templates/config/jetty.yml +6 -0
- data/lib/generators/blacklight/test_support_generator.rb +35 -0
- data/lib/railties/all_tests.rake +5 -23
- data/lib/railties/blacklight_cucumber.rake +2 -11
- data/lib/railties/blacklight_rspec.rake +2 -12
- data/test_support/bin/run-tests.sh +1 -1
- data/test_support/bin/setup-test-app.sh +123 -0
- data/test_support/bin/test.sh +21 -21
- data/test_support/features/bookmarks.feature +9 -3
- data/test_support/features/saved_searches.feature +3 -3
- data/test_support/features/search.feature +3 -3
- data/test_support/features/search_filters.feature +24 -26
- data/test_support/features/search_history.feature +9 -10
- data/test_support/features/search_sort.feature +4 -6
- data/test_support/features/step_definitions/general_steps.rb +0 -4
- data/test_support/features/step_definitions/search_result_steps.rb +2 -1
- data/test_support/features/step_definitions/search_steps.rb +32 -2
- data/test_support/spec/controllers/application_controller_spec.rb +8 -0
- data/test_support/spec/controllers/catalog_controller_spec.rb +3 -18
- data/test_support/spec/helpers/blacklight_helper_spec.rb +116 -20
- data/test_support/spec/helpers/catalog_helper_spec.rb +14 -6
- data/test_support/spec/helpers/facets_helper_spec.rb +1 -1
- data/test_support/spec/lib/blacklight_solr_document_more_like_this_spec.rb +18 -0
- data/test_support/spec/lib/blacklight_solr_document_spec.rb +54 -1
- data/test_support/spec/lib/blacklight_solr_response_spec.rb +153 -0
- data/test_support/spec/lib/facet_paginator_spec.rb +1 -1
- data/test_support/spec/lib/marc_export_spec.rb +14 -6
- data/test_support/spec/lib/solr_helper_spec.rb +22 -6
- data/test_support/spec/models/solr_docment_spec.rb +1 -4
- data/test_support/spec/{features → requests}/alternate_controller_spec.rb +3 -2
- data/test_support/spec/views/catalog/_facets.html.erb_spec.rb +20 -4
- data/test_support/spec/views/catalog/_show_sidebar.erb_spec.rb +25 -0
- metadata +53 -131
- data/app/assets/javascripts/blacklight/more_facets.js +0 -16
- data/app/assets/javascripts/jquery-1.4.2.min.js +0 -154
- data/app/assets/javascripts/jquery-ui-1.8.1.custom.min.js +0 -756
- data/app/assets/javascripts/jquery.uiExt.ajaxyDialog.js +0 -180
- data/app/assets/stylesheets/blacklight/_formatting.css.scss +0 -164
- data/app/assets/stylesheets/blacklight/grids/_susy_grid.css.scss +0 -72
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-anim_basic_16x16.gif +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_gloss-wave_35_558fd0_500x100.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-icons_2e4f81_256x240.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/jquery-ui-1.8.1.custom.css +0 -486
- data/app/models/solr_document.rb +0 -5
- data/app/views/catalog/email.erb +0 -1
- data/app/views/catalog/sms.erb +0 -1
- data/doc/Atom-Responses.md +0 -90
- 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 -78
- data/doc/Blacklight-3.8-release-notes-and-upgrade-guide.md +0 -11
- data/doc/Blacklight-Add-ons.md +0 -28
- data/doc/Blacklight-configuration.md +0 -301
- data/doc/Blacklight-on-Heroku.md +0 -135
- data/doc/Community-principles.md +0 -44
- data/doc/Configuring-and-Customizing-Blacklight.md +0 -271
- data/doc/Contributing-to-Blacklight.md +0 -25
- data/doc/Examples.md +0 -62
- data/doc/Extending-or-Modifying-Blacklight-Search-Behavior.md +0 -141
- data/doc/Home.md +0 -77
- data/doc/How-to-release-a-version.md +0 -37
- data/doc/Indexing-your-data-into-solr.md +0 -5
- data/doc/Integration-with-Rails-Footnotes.md +0 -20
- data/doc/Pagination.md +0 -38
- data/doc/Providing-your-own-view-templates.md +0 -109
- data/doc/Quickstart.md +0 -116
- data/doc/README.md +0 -77
- data/doc/README_SOLR.md +0 -245
- data/doc/Release-Notes-And-Upgrade-Guides.md +0 -14
- data/doc/Sunspot-for-indexing.md +0 -46
- data/doc/User-Authentication.md +0 -60
- data/doc/testing.md +0 -115
- data/lib/generators/blacklight/solr_conf_generator.rb +0 -26
- data/lib/generators/blacklight/templates/assets/standard.css.scss +0 -59
- data/lib/generators/blacklight/templates/config/blacklight_config.rb +0 -3
- data/lib/generators/blacklight/templates/config/compass.rb +0 -2
- data/lib/generators/blacklight/templates/solr_conf/schema.xml +0 -689
- data/lib/generators/blacklight/templates/solr_conf/solrconfig.xml +0 -1846
- data/lib/solrmarc.log.1 +0 -849
- data/test_support/spec/controllers/bookmarks_controller_spec.rb +0 -48
data/doc/README_SOLR.md
DELETED
@@ -1,245 +0,0 @@
|
|
1
|
-
#Solr in Blacklight
|
2
|
-
|
3
|
-
##Setting up Solr
|
4
|
-
|
5
|
-
Blacklight uses Solr as its "search engine".
|
6
|
-
More information about Solr is available at the Solr web site ( http://lucene.apache.org/solr/)
|
7
|
-
|
8
|
-
There are three sections to this document:
|
9
|
-
* Getting Solr
|
10
|
-
* Configuring Solr
|
11
|
-
* schema.xml
|
12
|
-
* solrconfig.xml
|
13
|
-
* SolrMARC
|
14
|
-
|
15
|
-
### Getting Solr
|
16
|
-
Blacklight distributes a pre-configured version of Solr (with the Jetty
|
17
|
-
container) as [[blacklight-jetty|https://github.com/projectblacklight/blacklight-jetty/tags]].
|
18
|
-
|
19
|
-
You can also use an existing Solr index (with some minor modifications).
|
20
|
-
If you want to start from a new version of Solr, follow the directions from the [[Solr tutorial|http://lucene.apache.org/solr/tutorial.html]]
|
21
|
-
|
22
|
-
You should now have a usable copy of Solr.
|
23
|
-
|
24
|
-
### Configuring Solr
|
25
|
-
####Solr Schema.xml
|
26
|
-
|
27
|
-
Between the `schema.xml` and `solrconfig.xml` you can change and tune the search behavior following directions from the [[Solr wiki|http://wiki.apache.org/solr/]]. Solr comes with example schema and solrconfig files, which you can use as a starting point for configuring your local Solr application.
|
28
|
-
|
29
|
-
Blacklight expects a uniqueKey field within your Solr index,
|
30
|
-
traditionally called `id`. The name of the unique key field can be
|
31
|
-
configured in your application's `SolrDocument`.
|
32
|
-
|
33
|
-
##### Blacklight community "best practices"
|
34
|
-
|
35
|
-
Solr uses a schema.xml file to define document fields (among other things). These fields store data for searching and for result display. You can find the example/solr/conf/schema.xml file in the Solr distribution you just downloaded and uncompressed.
|
36
|
-
|
37
|
-
Documentation about the Solr schema.xml file is available at (http://wiki.apache.org/solr/SchemaXml).
|
38
|
-
|
39
|
-
The default schema.xml file comes with some preset fields made to work with
|
40
|
-
the example data. If you don't already have a schema.xml setup, we
|
41
|
-
recommend using a simplified "fields" section like this:
|
42
|
-
```xml
|
43
|
-
<fields>
|
44
|
-
<field name="id" type="string" indexed="true" stored="true" required="true" />
|
45
|
-
<field name="text" type="text" indexed="true" stored="false" multiValued="true"/>
|
46
|
-
<field name="timestamp" type="date" indexed="true" stored="true" default="NOW" multiValued="false"/>
|
47
|
-
<field name="spell" type="textSpell" indexed="true" stored="true" multiValued="true"/>
|
48
|
-
<dynamicField name="*_i" type="sint" indexed="true" stored="true"/>
|
49
|
-
<dynamicField name="*_s" type="string" indexed="true" stored="true" multiValued="true"/>
|
50
|
-
<dynamicField name="*_l" type="slong" indexed="true" stored="true"/>
|
51
|
-
<dynamicField name="*_t" type="text" indexed="true" stored="true" multiValued="true"/>
|
52
|
-
<dynamicField name="*_b" type="boolean" indexed="true" stored="true"/>
|
53
|
-
<dynamicField name="*_f" type="sfloat" indexed="true" stored="true"/>
|
54
|
-
<dynamicField name="*_d" type="sdouble" indexed="true" stored="true"/>
|
55
|
-
<dynamicField name="*_dt" type="date" indexed="true" stored="true"/>
|
56
|
-
<dynamicField name="random*" type="random" />
|
57
|
-
<dynamicField name="*_facet" type="string" indexed="true" stored="true" multiValued="true" />
|
58
|
-
<dynamicField name="*_display" type="string" indexed="false" stored="true" />
|
59
|
-
</fields>
|
60
|
-
```
|
61
|
-
|
62
|
-
|
63
|
-
Additionally, replace all of the tags after the "fields" section, and before
|
64
|
-
the `</schema>` tag with this:
|
65
|
-
```xml
|
66
|
-
<uniqueKey>id</uniqueKey>
|
67
|
-
<defaultSearchField>text</defaultSearchField>
|
68
|
-
<solrQueryParser defaultOperator="OR"/>
|
69
|
-
<copyField source="*_facet" dest="text"/>
|
70
|
-
```
|
71
|
-
|
72
|
-
Now you have a basic schema.xml file ready. Other fields can be specified, including a primary document title (`title_display`) and format (`format`), but these are easily configured in your application's `CatalogController`.
|
73
|
-
|
74
|
-
Fields that are "indexed" are searchable.
|
75
|
-
|
76
|
-
Fields that are "stored" are can be viewed/displayed from the Solr search
|
77
|
-
results.
|
78
|
-
|
79
|
-
The fields with asterisks ('*') in their names are "dynamic" fields. These
|
80
|
-
allow you to create arbitrary tags at index time.
|
81
|
-
|
82
|
-
The *_facet field can be used for creating your facets. When you index,
|
83
|
-
simply define a field with _facet on the end:
|
84
|
-
category_facet
|
85
|
-
|
86
|
-
The *_display field can be used for storing text that doesn't need to be
|
87
|
-
indexed. An example would be the raw MARC for a record's detail view:
|
88
|
-
raw_marc_display
|
89
|
-
|
90
|
-
For text that will be queried (and possibly displayed), use the *_t type
|
91
|
-
field for tokenized text (text broken into pieces/words) or the *_s type
|
92
|
-
for queries that should exactly match the field contents:
|
93
|
-
description_t
|
94
|
-
url_s
|
95
|
-
|
96
|
-
The Blacklight application is generic enough to work with any Solr schema, but to
|
97
|
-
manipulate the search results and single record displays, you'll need to know the
|
98
|
-
stored fields in your indexed documents.
|
99
|
-
|
100
|
-
For more information, refer to the Solr documentation:
|
101
|
-
http://wiki.apache.org/solr/SchemaXml
|
102
|
-
|
103
|
-
|
104
|
-
#####solrconfig.xml
|
105
|
-
|
106
|
-
Solr uses the solrconfig.xml file to define searching configurations, set cache options, etc.
|
107
|
-
You can find the examples/solr/conf/solrconfig.xml in the distribution directory you just uncompressed.
|
108
|
-
|
109
|
-
Documentation about the solrconfig.xml file is available at (http://wiki.apache.org/solr/SolrConfigXml).
|
110
|
-
|
111
|
-
Blacklight expects two request handlers to be defined -- one to handle
|
112
|
-
general search requests and one to handle single-document lookup. The
|
113
|
-
names of these request handlers are configurable, but are called
|
114
|
-
"search" and "document" respectively, out of the box.
|
115
|
-
|
116
|
-
|
117
|
-
#####Solr Search Request Handlers
|
118
|
-
|
119
|
-
When Blacklight does a collection search, it sends a request to a Solr
|
120
|
-
request handler named "search". The most important settings in this handler
|
121
|
-
definition are the "fl" param (field list) and the facet params.
|
122
|
-
|
123
|
-
The "fl" param specifies which fields are returned in a Solr response.
|
124
|
-
The facet related params set up the faceting mechanism.
|
125
|
-
|
126
|
-
Find out more about the basic params:
|
127
|
-
http://wiki.apache.org/solr/DisMaxRequestHandler
|
128
|
-
|
129
|
-
Find out more about the faceting params:
|
130
|
-
http://wiki.apache.org/solr/SimpleFacetParameters
|
131
|
-
|
132
|
-
|
133
|
-
######How the "fl" param works in Blacklight's request handlers
|
134
|
-
|
135
|
-
Blacklight comes with a set of "default" views for rendering each document
|
136
|
-
in a search results page. This view simply loops through all of the fields
|
137
|
-
returned in each document in the Solr response. The "fl" (field list) param
|
138
|
-
tells Solr which fields to include in the documents in the response ...
|
139
|
-
and these are the fields rendered in the Blacklight default views.
|
140
|
-
Thus, the fields you want rendered must be specified in "fl". Note that
|
141
|
-
only "stored" fields will be available; if you want a field to be rendered
|
142
|
-
in the result, it must be "stored" per the field definition in schema.xml.
|
143
|
-
|
144
|
-
The "fl" parameter definition in the "search" handler looks like this:
|
145
|
-
```xml
|
146
|
-
<str name="fl">id,score,author_display,(....lots of other fields)</str>
|
147
|
-
```
|
148
|
-
You may also use an asterisk plus "score":
|
149
|
-
```xml
|
150
|
-
<str name="fl">*,score</str>
|
151
|
-
```
|
152
|
-
|
153
|
-
######How the facet params work in Blacklight's request handlers
|
154
|
-
|
155
|
-
In the search results view, Blacklight will look into the Solr response for
|
156
|
-
facets. If you specify any facet.field params in your "search" handler,
|
157
|
-
they will automatically get displayed in the facets list:
|
158
|
-
```xml
|
159
|
-
<str name="facet.field">format</str>
|
160
|
-
<str name="facet.field">language_facet</str>
|
161
|
-
```
|
162
|
-
|
163
|
-
|
164
|
-
#####Blacklight's "search" request handler: for search results
|
165
|
-
|
166
|
-
When Blacklight displays a list of search results, it uses a Solr request
|
167
|
-
handler named "search." Thus, the field list (fl param) for the "search"
|
168
|
-
request handler should be tailored to what will be displayed in a search
|
169
|
-
results page. Generally, this will not include fields containing a large
|
170
|
-
quantity of text. The facet param should contain the facets to be
|
171
|
-
displayed with the search results.
|
172
|
-
```xml
|
173
|
-
|
174
|
-
<requestHandler name="search" class="solr.SearchHandler" >
|
175
|
-
<lst name="defaults">
|
176
|
-
<str name="defType">dismax</str>
|
177
|
-
<str name="echoParams">explicit</str>
|
178
|
-
<!-- list fields to be returned in the "fl" param -->
|
179
|
-
<str name="fl">*,score</str>
|
180
|
-
|
181
|
-
<str name="facet">on</str>
|
182
|
-
<str name="facet.mincount">1</str>
|
183
|
-
<str name="facet.limit">10</str>
|
184
|
-
|
185
|
-
<!-- list fields to be displayed as facets here. -->
|
186
|
-
<str name="facet.field">format</str>
|
187
|
-
<str name="facet.field">language_facet</str>
|
188
|
-
|
189
|
-
<str name="q.alt">*:*</str>
|
190
|
-
</lst>
|
191
|
-
</requestHandler>
|
192
|
-
```
|
193
|
-
|
194
|
-
#####Blacklight's "document" request handler: for a single record
|
195
|
-
|
196
|
-
When Blacklight displays a single record it uses a Solr request handler
|
197
|
-
named "document". The "document" handler doesn't necessarily need to be
|
198
|
-
different than the "search" handler, but it can be used to control which
|
199
|
-
fields are available to display a single document. In the example below,
|
200
|
-
there is no faceting set (facets are not displayed with a single record)
|
201
|
-
and the "rows" param is set to 1 (since there will only be a single record).
|
202
|
-
Also, the field list ("fl" param) could include fields containing large
|
203
|
-
text values if they are desired for record display. Is is acceptable to
|
204
|
-
include large amounts of data, because this handler should only be used
|
205
|
-
to query for one document:
|
206
|
-
|
207
|
-
<requestHandler name="document" class="solr.SearchHandler">
|
208
|
-
<lst name="defaults">
|
209
|
-
<str name="echoParams">explicit</str>
|
210
|
-
<str name="fl">*</str>
|
211
|
-
<str name="rows">1</str>
|
212
|
-
<str name="q">{!raw f=id v=$id}</str>
|
213
|
-
<!-- use id=blah instead of q=id:blah -->
|
214
|
-
</lst>
|
215
|
-
</requestHandler>
|
216
|
-
|
217
|
-
A Solr query for a single record might look like this:
|
218
|
-
http://(yourSolrBaseUrl)/solr/select?id=my_doc_id&qt=document
|
219
|
-
|
220
|
-
|
221
|
-
####Blacklight Solr Schema and Solrconfig File Templates
|
222
|
-
|
223
|
-
Blacklight provides schema.xml and solrconfig.xml files as starting points:
|
224
|
-
|
225
|
-
https://github.com/projectblacklight/blacklight-jetty/blob/master/solr/conf/schema.xml
|
226
|
-
|
227
|
-
https://github.com/projectblacklight/blacklight-jetty/blob/master/solr/conf/solrconfig.xml
|
228
|
-
|
229
|
-
#SolrMARC: from Marc data to Solr documents
|
230
|
-
|
231
|
-
The SolrMARC project is designed to create a Solr index from raw MARC data.
|
232
|
-
It can be configured easily and used with the basic parsing and indexing
|
233
|
-
supplied. It is also readily customized for a site's unique requirements.
|
234
|
-
|
235
|
-
The project software and documentation is available at [[http://code.google.com/p/solrmarc]]
|
236
|
-
|
237
|
-
Blacklight comes with an embedded SolrMarc, with some default config that matches the default Blacklight setup, and provides some rake tasks to easily index docs with SolrMarc according to your app's environment. There is no need to manually install/configure SolrMarc yourself. From your application's home directory simply run:
|
238
|
-
```bash
|
239
|
-
rake solr:marc:index:info
|
240
|
-
```
|
241
|
-
to see options. Run `rake solr:marc:index` to actually do indexing. Like all rake tasks, by default this will use your 'development' environment; add "RAILS_ENV=production" to instead index to the solr you've labelled production in your config/solr.yml file.
|
242
|
-
|
243
|
-
The solrmarc config files are in your app's config/SolrMarc directory, you can edit them there for local config.
|
244
|
-
|
245
|
-
If you'd like to use a different or more recent version of SolrMarc.jar, you can put it in your app at ./solr_marc/SolrMarc.jar, and the built-in rake tasks will use your local SolrMarc.jar instead of the one bundled with Blacklight.
|
@@ -1,14 +0,0 @@
|
|
1
|
-
This is for upgrade guides for each version.
|
2
|
-
* [[Blacklight 3.8 Release Notes And Upgrade Guide]] (Nov 2, 2012)
|
3
|
-
* [[Blacklight 3.7 Release Notes And Upgrade Guide]] (Sep 25, 2012)
|
4
|
-
* [[Blacklight 3.6 Release Notes And Upgrade Guide]] (Sep 10, 2012)
|
5
|
-
* [[Blacklight 3.5 Release Notes And Upgrade Guide]] (Jun 25, 2012)
|
6
|
-
* [[Blacklight 3.4 Release Notes And Upgrade Guide]] (Apr 24, 2012)
|
7
|
-
* [[Blacklight 3.3 Release Notes And Upgrade Guide]] (Mar 19, 2012)
|
8
|
-
* [[Blacklight 3.2 Release Notes And Upgrade Guide]] (Dec 15, 2011)
|
9
|
-
* [[Blacklight 3.1 Release Notes And Upgrade Guide]] (Sep 28, 2011)
|
10
|
-
* [[Blacklight 3.0 Release Notes And Upgrade Guide]] (July 11, 2011)
|
11
|
-
|
12
|
-
Unreleased
|
13
|
-
|
14
|
-
* [[Blacklight 4.x Release Notes And Upgrade Guide]] (Nov X, 2012)
|
data/doc/Sunspot-for-indexing.md
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
If you have a Rails application as your data store, you may look to [Sunspot](http://outoftime.github.com/sunspot/) to help index your ActiveRecord models. Sunspot provides a nice DSL that makes it easy to index your models and associations. There is one gotcha, though, for using Sunspot with Blacklight. Both Sunspot and Blacklight expect the Solr uniqueKey to be in the "id" field. Sunspot will use the class of your model plus the primary key of that instance as the value for the id field. So a value for the id field may look like this: "Resource 123".
|
2
|
-
|
3
|
-
When a Sunspot-indexed Solr is used with Blacklight your model names and primary keys are exposed in your URLs. You may want to use a different value as your id value for Blacklight to use for document recall and URLs. For instance you want to use a unique filename as your id value for Blacklight.
|
4
|
-
|
5
|
-
You can use something like the following monkeypatch of Sunspot (1.2) by placing it in config/initializers/sunspot_monkeypatch_id.rb. It takes the value of the id field that Sunspot creates (Resource 123) and places it in the resource_id_ss field. It then overwrites the id value with the value from the filename field. The second part then takes a Solr hit and reverses it so that Sunspot can retrieve your models.
|
6
|
-
|
7
|
-
```ruby
|
8
|
-
# for using a different value for the id field of your Solr documents
|
9
|
-
Sunspot::Indexer.module_eval do
|
10
|
-
alias :old_prepare :prepare
|
11
|
-
def prepare(model)
|
12
|
-
document = old_prepare(model)
|
13
|
-
document.fields_by_name(:resource_id_ss).first.value = document.fields_by_name(:id).first.value
|
14
|
-
if !document.fields_by_name(:filename).blank? and !document.fields_by_name(:filename).first.blank?
|
15
|
-
document.fields_by_name(:id).first.value = document.fields_by_name(:filename).first.value
|
16
|
-
end
|
17
|
-
document
|
18
|
-
end
|
19
|
-
|
20
|
-
alias :old_remove :remove
|
21
|
-
def remove(*models)
|
22
|
-
@connection.delete_by_id(
|
23
|
-
models.map do |model|
|
24
|
-
prepare(model).fields_by_name(:id).first.value
|
25
|
-
end
|
26
|
-
)
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
# to allow searching with Sunspot's DSL as well to retrieve your models
|
32
|
-
class Sunspot::Search::Hit
|
33
|
-
def initialize(raw_hit, highlights, search)
|
34
|
-
raw_hit['id'] = raw_hit['resource_id_ss']
|
35
|
-
@class_name, @primary_key = *raw_hit['id'].match(/([^ ]+) (.+)/)[1..2]
|
36
|
-
@score = raw_hit['score']
|
37
|
-
@search = search
|
38
|
-
@stored_values = raw_hit
|
39
|
-
@stored_cache = {}
|
40
|
-
@highlights = highlights
|
41
|
-
end
|
42
|
-
end
|
43
|
-
```
|
44
|
-
|
45
|
-
|
46
|
-
|
data/doc/User-Authentication.md
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
Blacklight does not require user authentication, however, if included, Blacklight can provide additional features for users ([[Bookmarks]], [[Saved Searches]], etc). Because of the wide range of institutional needs and capabilities, Blacklight does not require a specific user authentication provider.
|
2
|
-
|
3
|
-
## Installing with Devise
|
4
|
-
|
5
|
-
If you are rolling your own user authentication system, we highly recommend [[Devise|https://github.com/plataformatec/devise]], an extremely flexible authentication solution that is relatively straightforward. For directions to install the Blacklight gem using devise, see the [[Quickstart]].
|
6
|
-
|
7
|
-
## Install and Use (with a custom user authentication system)
|
8
|
-
|
9
|
-
Create a new rails 3 application
|
10
|
-
```bash
|
11
|
-
$ rails new my_app
|
12
|
-
```
|
13
|
-
|
14
|
-
Add blacklight to your gem file
|
15
|
-
```bash
|
16
|
-
edit ./my_app/Gemfile
|
17
|
-
```
|
18
|
-
```ruby.
|
19
|
-
# Append this line to the end of the file:
|
20
|
-
gem 'blacklight'
|
21
|
-
```
|
22
|
-
|
23
|
-
```bash
|
24
|
-
$ bundle install
|
25
|
-
```
|
26
|
-
|
27
|
-
If you have a `User` model already, the Blacklight generator will connect to it automatically during installation. However, you will need to make sure the following named routes are included in your /config/routes.rb file:
|
28
|
-
|
29
|
-
```ruby
|
30
|
-
match 'your_login', :to => 'Your User Session Controller # Log in action', :as => 'new_user_session'
|
31
|
-
match 'your_logout', :to => 'Your User Session Controller # Log Out action', :as => 'destroy_user_session'
|
32
|
-
match 'your_account_page', :to => 'Your User Session Controller # Account edit action', :as => 'edit_user_registration'
|
33
|
-
```
|
34
|
-
|
35
|
-
One blacklight view partial uses `#to_s` on your user model to get a user-displayable account name/identifier for the currently logged in account, so you probably want to have such a method.
|
36
|
-
|
37
|
-
Finally, you will need to make sure the following methods are available both on controllers and as helpers:
|
38
|
-
|
39
|
-
* `current_user` - Which should return an ActiveRecord-based user object that include Blacklight::User
|
40
|
-
* `user_session` - Which are included in your /config/routes.rb file:
|
41
|
-
|
42
|
-
Optionally,
|
43
|
-
* `guest_user` - Which should return an ActiveRecord-based temporary guest user object available across the current user session.
|
44
|
-
* `current_or_guest_user` - Which should return the `current_user`, if available, or `guest_user`. If you don't provide this method, a stub method (that just returns `current_user`) will be provided for you.
|
45
|
-
|
46
|
-
If you are supporting guest users, if a guest user logs in, you should call `#transfer_guest_user_actions_to_current_user` to move any persisted data to the permanent user.
|
47
|
-
|
48
|
-
> The `devise-guests` gem implements the `guest_user`, `current_or_guest_user` and callbacks for Blacklight applications using devise. It may be a useful reference for rolling your own functionality. See [DeviseGuests::Controllers::Helpers](https://github.com/cbeer/devise-guests/blob/master/lib/devise-guests/controllers/helpers.rb)
|
49
|
-
|
50
|
-
Once these are in place, you can run the Blacklight Installation Generator:
|
51
|
-
|
52
|
-
```bash
|
53
|
-
$ rails generate blacklight [MODEL NAME]
|
54
|
-
```
|
55
|
-
Where model name is the name of your user model.
|
56
|
-
|
57
|
-
Execute your migrations, and you should be good to go.
|
58
|
-
```bash
|
59
|
-
$ rake db:migrate
|
60
|
-
```
|
data/doc/testing.md
DELETED
@@ -1,115 +0,0 @@
|
|
1
|
-
## Using Blacklight source checkout as gem for development
|
2
|
-
|
3
|
-
|
4
|
-
The ordinary install instructions install the BL gem (which is not
|
5
|
-
full source code) in wherever your system installs gems.
|
6
|
-
|
7
|
-
Sometimes, especially for development, it's useful to check out
|
8
|
-
a complete copy of the blacklight source code, and link your app
|
9
|
-
to that as a 'gem' instead.
|
10
|
-
|
11
|
-
Checkout the code:
|
12
|
-
|
13
|
-
$ git clone git@github.com:projectblacklight/blacklight.git
|
14
|
-
|
15
|
-
|
16
|
-
## Automatically generate a test application (and run the tests)
|
17
|
-
Blacklight comes with a bash script you can use to create a complete test application. It supports Ruby 1.8.7, Ruby 1.9.2+, and JRuby 1.6.2.
|
18
|
-
|
19
|
-
Requirements:
|
20
|
-
|
21
|
-
* rvm - (https://rvm.beginrescueend.com/)
|
22
|
-
* Java (1.5 or above)
|
23
|
-
|
24
|
-
From the root directory of your git checkout:
|
25
|
-
|
26
|
-
$ ./test_support/bin/test.sh 1.8.7
|
27
|
-
|
28
|
-
This bash script will create a fresh application in tmp/test_app - Inside this test application it will run a bundle install, execute required generators, run migrations, configure the test environment, install a jetty server with test data, and execute all of blacklight's rspec and cucumber tests.
|
29
|
-
|
30
|
-
Subsequent calls to this script will overwrite the test application.
|
31
|
-
|
32
|
-
## Manually Installing a test/stub application
|
33
|
-
|
34
|
-
1. Create a new rails 3 application
|
35
|
-
|
36
|
-
$ rails new test-app
|
37
|
-
$ cd my_app
|
38
|
-
|
39
|
-
Rails automatically created an `index.html` file; Blacklight will provide a default `root` route, so you probably want to remove it:
|
40
|
-
|
41
|
-
$ rm public/index.html
|
42
|
-
|
43
|
-
|
44
|
-
2. In your local app's Gemfile, simply specify that it should find
|
45
|
-
the Blacklight gem at this source checkout location:
|
46
|
-
|
47
|
-
gem 'blacklight', :path=>"./relative/path/to/blacklight_checkout"
|
48
|
-
|
49
|
-
You can have the blacklight source checkout anywhere you want, referred to by absolute or relative path. You can have it inside your local app's directory if you want, or you can have it outside using a relative path beginning with "../". If you have it inside your app's root, you can even use 'git submodule' techniques to link your app to a particular
|
50
|
-
git commit, like some of us did in Rails2 Blacklight. (But you probably don't want it in your local apps ./vendor/plugins, that'll likely confuse Rails, since it's already being referred to in your Gemfile).
|
51
|
-
|
52
|
-
3. update the bundle
|
53
|
-
|
54
|
-
$ bundle install
|
55
|
-
|
56
|
-
|
57
|
-
3. You also need to include some gems in your test app's Gemfile needed for running our tests:
|
58
|
-
|
59
|
-
group :development, :test do
|
60
|
-
gem "rspec"
|
61
|
-
gem "rspec-rails"
|
62
|
-
gem "cucumber-rails"
|
63
|
-
gem "database_cleaner"
|
64
|
-
gem "capybara"
|
65
|
-
gem "webrat"
|
66
|
-
gem "jettywrapper"
|
67
|
-
end
|
68
|
-
|
69
|
-
3. And some gems for using sass in the asset pipeline, inside group :assets that's already there in a rails 3.1 app, add:
|
70
|
-
|
71
|
-
group :assets do
|
72
|
-
gem 'therubyracer' # not needed if you are on Windows or OSX where a JS runtime can already be found
|
73
|
-
end
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
3. Run the cucumber generator:
|
79
|
-
|
80
|
-
rails g cucumber:install
|
81
|
-
|
82
|
-
|
83
|
-
3. Install blacklight using Devise for user authentication:
|
84
|
-
|
85
|
-
$ gem install devise
|
86
|
-
$ rails generate blacklight --devise
|
87
|
-
|
88
|
-
If you would like to integrate with an existing user authentication provider, see [[User Authentication]].
|
89
|
-
|
90
|
-
4. Run your database migrations
|
91
|
-
|
92
|
-
$ rake db:migrate
|
93
|
-
|
94
|
-
|
95
|
-
5. You need to install a jetty/solr with test data for testing. You can do that like this (from your stub app home directory):
|
96
|
-
|
97
|
-
$ rails generate blacklight:jetty test_jetty -e test
|
98
|
-
$ rake solr:marc:index_test_data RAILS_ENV=test
|
99
|
-
|
100
|
-
|
101
|
-
## Running the Tests
|
102
|
-
Now use some rake tasks that come with Blacklight to actually run the tests. Run these from your stub app:
|
103
|
-
|
104
|
-
* `rake blacklight:spec:with_solr`
|
105
|
-
* `rake blacklight:cucumber:with_solr`
|
106
|
-
|
107
|
-
You can also run the tests without starting the test_jetty (however, tests will fail unless you start it yourself):
|
108
|
-
|
109
|
-
* `rake blacklight:cucumber`
|
110
|
-
* `rake blacklight:spec`
|
111
|
-
|
112
|
-
The standard rails tasks for cucumber/rspec are all included with
|
113
|
-
blacklight: prefix, and should work as expected, but using
|
114
|
-
specs/features defined in BL plugin instead of in your local
|
115
|
-
app. (Not every variant has a :with_solr yet).
|