blacklight 3.1.2 → 3.2.0pre1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -2
- data/README.md +7 -2
- data/VERSION +1 -1
- data/app/assets/images/favicon.ico +0 -0
- data/app/assets/javascripts/blacklight/blacklight.js +23 -1
- data/app/assets/stylesheets/blacklight/_catalog.css.scss +369 -0
- data/app/assets/stylesheets/blacklight/_facets.css.scss +117 -0
- data/app/assets/stylesheets/blacklight/_folder.css.scss +38 -0
- data/app/assets/stylesheets/blacklight/_formatting.css.scss +164 -0
- data/app/assets/stylesheets/blacklight/_header.css.scss +36 -0
- data/app/assets/stylesheets/blacklight/_layout.css.scss +79 -0
- data/app/assets/stylesheets/blacklight/_print.css.scss +54 -0
- data/app/assets/stylesheets/blacklight/_search_history.css.scss +44 -0
- data/app/assets/stylesheets/blacklight/_susy_framework.css.scss +228 -0
- data/app/assets/stylesheets/blacklight/blacklight.css.scss +27 -0
- data/app/assets/stylesheets/blacklight/blacklight_defaults.css.scss +48 -0
- data/app/controllers/bookmarks_controller.rb +2 -1
- data/app/controllers/folder_controller.rb +4 -0
- data/app/controllers/saved_searches_controller.rb +4 -0
- data/app/controllers/search_history_controller.rb +4 -0
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +64 -104
- data/app/helpers/blacklight/catalog_helper_behavior.rb +4 -4
- data/app/helpers/blacklight/facets_helper_behavior.rb +52 -5
- data/app/helpers/blacklight/render_constraints_helper_behavior.rb +14 -59
- data/app/helpers/blacklight/search_history_constraints_helper_behavior.rb +56 -0
- data/app/helpers/search_history_constraints_helper.rb +3 -0
- data/app/models/record_mailer.rb +1 -2
- data/app/views/_flash_msg.html.erb +4 -5
- data/app/views/_user_util_links.html.erb +3 -1
- data/app/views/bookmarks/index.html.erb +2 -2
- data/app/views/catalog/_bookmark_control.html.erb +6 -6
- data/app/views/catalog/_facet_layout.html.erb +4 -0
- data/app/views/catalog/_facet_limit.html.erb +20 -33
- data/app/views/catalog/_facets.html.erb +1 -5
- data/app/views/catalog/_folder_control.html.erb +5 -5
- data/app/views/catalog/_index_default.html.erb +1 -1
- data/app/views/catalog/_search_form.html.erb +4 -3
- data/app/views/catalog/_show_default.html.erb +1 -1
- data/app/views/catalog/_show_tools.html.erb +6 -6
- data/app/views/catalog/_sort_and_per_page.html.erb +1 -1
- data/app/views/catalog/index.atom.builder +2 -2
- data/app/views/catalog/index.rss.builder +1 -1
- data/app/views/catalog/opensearch.xml.builder +10 -0
- data/app/views/catalog/show.html.erb +1 -1
- data/app/views/folder/_tools.html.erb +4 -4
- data/app/views/layouts/blacklight.html.erb +25 -37
- data/app/views/record_mailer/email_record.text.erb +1 -1
- data/app/views/record_mailer/sms_record.text.erb +2 -2
- data/app/views/search_history/index.html.erb +1 -1
- data/blacklight.gemspec +11 -9
- data/lib/{generators/blacklight/templates/SolrMarc.jar → SolrMarc.jar} +0 -0
- data/lib/blacklight.rb +5 -3
- data/lib/blacklight/catalog.rb +3 -4
- data/lib/blacklight/configurable.rb +54 -39
- data/lib/blacklight/configuration.rb +126 -0
- data/lib/blacklight/configuration/fields.rb +142 -0
- data/lib/blacklight/configuration/search_field.rb +12 -0
- data/lib/blacklight/configuration/solr_field.rb +12 -0
- data/lib/blacklight/configuration/sort_field.rb +17 -0
- data/lib/blacklight/controller.rb +16 -14
- data/lib/blacklight/engine.rb +1 -1
- data/lib/blacklight/global_configurable.rb +46 -0
- data/lib/blacklight/search_fields.rb +21 -54
- data/lib/blacklight/solr/document.rb +13 -3
- data/lib/blacklight/solr_helper.rb +88 -52
- data/lib/blacklight/utils.rb +18 -0
- data/lib/generators/blacklight/assets_generator.rb +14 -20
- data/lib/generators/blacklight/blacklight_generator.rb +14 -6
- data/lib/generators/blacklight/jetty_generator.rb +1 -1
- data/lib/generators/blacklight/templates/assets/standard.css.scss +51 -0
- data/lib/generators/blacklight/templates/catalog_controller.rb +148 -0
- data/lib/generators/blacklight/templates/config/blacklight_config.rb +2 -239
- data/lib/generators/blacklight/templates/config/sass.rb +5 -0
- data/lib/generators/blacklight/templates/solr_conf/schema.xml +514 -164
- data/lib/generators/blacklight/templates/solr_conf/solrconfig.xml +1591 -323
- data/lib/generators/blacklight/templates/solr_document.rb +2 -0
- data/lib/railties/all_tests.rake +36 -3
- data/lib/railties/blacklight_cucumber.rake +6 -4
- data/lib/railties/blacklight_rspec.rake +5 -4
- data/test_support/bin/run-tests.sh +2 -13
- data/test_support/bin/test.sh +30 -23
- data/test_support/features/did_you_mean.feature +14 -13
- data/test_support/features/step_definitions/saved_searches_steps.rb +1 -1
- data/test_support/features/step_definitions/search_steps.rb +4 -4
- data/test_support/spec/controllers/application_controller_spec.rb +3 -13
- data/test_support/spec/controllers/catalog_controller_spec.rb +102 -24
- data/test_support/spec/controllers/folder_controller_spec.rb +7 -1
- data/test_support/spec/helpers/blacklight_helper_spec.rb +45 -34
- data/test_support/spec/helpers/facets_helper_spec.rb +68 -0
- data/test_support/spec/helpers/html_head_helper_spec.rb +37 -0
- data/test_support/spec/helpers/{render_constraints_helper_spec.rb → search_history_constraints_helper_spec.rb} +26 -7
- data/test_support/spec/lib/blacklight_configurable_spec.rb +92 -0
- data/test_support/spec/lib/blacklight_configuration_spec.rb +295 -0
- data/test_support/spec/lib/{configurable_spec.rb → global_configurable_spec.rb} +2 -2
- data/test_support/spec/lib/search_fields_spec.rb +26 -29
- data/test_support/spec/{helpers → lib}/solr_helper_spec.rb +268 -287
- data/test_support/spec/lib/tasks/solr_marc_task_spec.rb +1 -1
- data/test_support/spec/lib/utils_spec.rb +58 -0
- data/test_support/spec/models/solr_docment_spec.rb +4 -8
- data/test_support/spec/views/catalog/_facets.html.erb_spec.rb +27 -170
- data/test_support/spec/views/catalog/_index_default.erb_spec.rb +38 -20
- data/test_support/spec/views/catalog/_show_default.erb_spec.rb +38 -19
- data/test_support/spec/views/catalog/index.atom.builder_spec.rb +19 -1
- metadata +148 -145
- data/app/assets/stylesheets/blacklight/blacklight.css +0 -493
- data/app/assets/stylesheets/yui.css +0 -31
- data/app/views/catalog/opensearch.xml.erb +0 -11
- data/doc/Atom-Responses.md +0 -90
- data/doc/CUSTOMIZING.md +0 -121
- data/doc/Extending-blacklight-with-the-document-extension-framework.md +0 -1
- data/doc/Extending-or-Modifying-Blacklight-Search-Behavior.md +0 -131
- data/doc/Features.md +0 -147
- data/doc/Integration-with-Rails-Footnotes.md +0 -20
- data/doc/Pagination.md +0 -38
- data/doc/Quickstart.md +0 -97
- data/doc/Upgrading-Guide.md +0 -98
- data/doc/User-Authentication.md +0 -54
- data/doc/Using-a-custom-solr-uniquekey-field.md +0 -36
- data/lib/blacklight/comma_link_renderer.rb +0 -28
- data/lib/railties/jetty_solr_server.rb +0 -108
- data/test_support/spec/views/catalog/show.html.erb_spec.rb +0 -101
@@ -1,31 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
|
3
|
-
Code licensed under the BSD License:
|
4
|
-
http://developer.yahoo.net/yui/license.txt
|
5
|
-
version: 2.6.0
|
6
|
-
*/
|
7
|
-
html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}del,ins{text-decoration:none;}
|
8
|
-
|
9
|
-
/*
|
10
|
-
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
|
11
|
-
Code licensed under the BSD License:
|
12
|
-
http://developer.yahoo.net/yui/license.txt
|
13
|
-
version: 2.6.0
|
14
|
-
*/
|
15
|
-
h1{font-size:138.5%;}h2{font-size:123.1%;}h3{font-size:108%;}h1,h2,h3{margin:1em 0;}h1,h2,h3,h4,h5,h6,strong{font-weight:bold;}abbr,acronym{border-bottom:1px dotted #000;cursor:help;} em{font-style:italic;}blockquote,ul,ol,dl{margin:1em;}ol,ul,dl{margin-left:2em;}ol li{list-style:decimal outside;}ul li{list-style:disc outside;}dl dd{margin-left:1em;}th,td{border:1px solid #000;padding:.5em;}th{font-weight:bold;text-align:center;}caption{margin-bottom:.5em;text-align:center;}p,fieldset,table,pre{margin-bottom:1em;}input[type=text],input[type=password],textarea{width:12.25em;*width:11.9em;}
|
16
|
-
|
17
|
-
/*
|
18
|
-
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
|
19
|
-
Code licensed under the BSD License:
|
20
|
-
http://developer.yahoo.net/yui/license.txt
|
21
|
-
version: 2.6.0
|
22
|
-
*/
|
23
|
-
body{font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}select,input,button,textarea{font:99% arial,helvetica,clean,sans-serif;}table{font-size:inherit;font:100%;}pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:100%;}
|
24
|
-
|
25
|
-
/*
|
26
|
-
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
|
27
|
-
Code licensed under the BSD License:
|
28
|
-
http://developer.yahoo.net/yui/license.txt
|
29
|
-
version: 2.6.0
|
30
|
-
*/
|
31
|
-
body{text-align:center;}#ft{clear:both;}#doc,#doc2,#doc3,#doc4,.yui-t1,.yui-t2,.yui-t3,.yui-t4,.yui-t5,.yui-t6,.yui-t7{margin:auto;text-align:left;width:57.69em;*width:56.25em;min-width:750px;}#doc2{width:73.076em;*width:71.25em;}#doc3{margin:auto 10px;width:auto;}#doc4{width:74.923em;*width:73.05em;}.yui-b{position:relative;}.yui-b{_position:static;}#yui-main .yui-b{position:static;}#yui-main,.yui-g .yui-u .yui-g{width:100%;}{width:100%;}.yui-t1 #yui-main,.yui-t2 #yui-main,.yui-t3 #yui-main{float:right;margin-left:-25em;}.yui-t4 #yui-main,.yui-t5 #yui-main,.yui-t6 #yui-main{float:left;margin-right:-25em;}.yui-t1 .yui-b{float:left;width:12.30769em;*width:12.00em;}.yui-t1 #yui-main .yui-b{margin-left:13.30769em;*margin-left:13.05em;}.yui-t2 .yui-b{float:left;width:13.8461em;*width:13.50em;}.yui-t2 #yui-main .yui-b{margin-left:14.8461em;*margin-left:14.55em;}.yui-t3 .yui-b{float:left;width:23.0769em;*width:22.50em;}.yui-t3 #yui-main .yui-b{margin-left:24.0769em;*margin-left:23.62em;}.yui-t4 .yui-b{float:right;width:13.8456em;*width:13.50em;}.yui-t4 #yui-main .yui-b{margin-right:14.8456em;*margin-right:14.55em;}.yui-t5 .yui-b{float:right;width:18.4615em;*width:18.00em;}.yui-t5 #yui-main .yui-b{margin-right:19.4615em;*margin-right:19.125em;}.yui-t6 .yui-b{float:right;width:23.0769em;*width:22.50em;}.yui-t6 #yui-main .yui-b{margin-right:24.0769em;*margin-right:23.62em;}.yui-t7 #yui-main .yui-b{display:block;margin:0 0 1em 0;}#yui-main .yui-b{float:none;width:auto;}.yui-gb .yui-u,.yui-g .yui-gb .yui-u,.yui-gb .yui-g,.yui-gb .yui-gb,.yui-gb .yui-gc,.yui-gb .yui-gd,.yui-gb .yui-ge,.yui-gb .yui-gf,.yui-gc .yui-u,.yui-gc .yui-g,.yui-gd .yui-u{float:left;}.yui-g .yui-u,.yui-g .yui-g,.yui-g .yui-gb,.yui-g .yui-gc,.yui-g .yui-gd,.yui-g .yui-ge,.yui-g .yui-gf,.yui-gc .yui-u,.yui-gd .yui-g,.yui-g .yui-gc .yui-u,.yui-ge .yui-u,.yui-ge .yui-g,.yui-gf .yui-g,.yui-gf .yui-u{float:right;}.yui-g div.first,.yui-gb div.first,.yui-gc div.first,.yui-gd div.first,.yui-ge div.first,.yui-gf div.first,.yui-g .yui-gc div.first,.yui-g .yui-ge div.first,.yui-gc div.first div.first{float:left;}.yui-g .yui-u,.yui-g .yui-g,.yui-g .yui-gb,.yui-g .yui-gc,.yui-g .yui-gd,.yui-g .yui-ge,.yui-g .yui-gf{width:49.1%;}.yui-gb .yui-u,.yui-g .yui-gb .yui-u,.yui-gb .yui-g,.yui-gb .yui-gb,.yui-gb .yui-gc,.yui-gb .yui-gd,.yui-gb .yui-ge,.yui-gb .yui-gf,.yui-gc .yui-u,.yui-gc .yui-g,.yui-gd .yui-u{width:32%;margin-left:1.99%;}.yui-gb .yui-u{*margin-left:1.9%;*width:31.9%;}.yui-gc div.first,.yui-gd .yui-u{width:66%;}.yui-gd div.first{width:32%;}.yui-ge div.first,.yui-gf .yui-u{width:74.2%;}.yui-ge .yui-u,.yui-gf div.first{width:24%;}.yui-g .yui-gb div.first,.yui-gb div.first,.yui-gc div.first,.yui-gd div.first{margin-left:0;}.yui-g .yui-g .yui-u,.yui-gb .yui-g .yui-u,.yui-gc .yui-g .yui-u,.yui-gd .yui-g .yui-u,.yui-ge .yui-g .yui-u,.yui-gf .yui-g .yui-u{width:49%;*width:48.1%;*margin-left:0;}.yui-g .yui-g .yui-u{width:48.1%;}.yui-g .yui-gb div.first,.yui-gb .yui-gb div.first{*margin-right:0;*width:32%;_width:31.7%;}.yui-g .yui-gc div.first,.yui-gd .yui-g{width:66%;}.yui-gb .yui-g div.first{*margin-right:4%;_margin-right:1.3%;}.yui-gb .yui-gc div.first,.yui-gb .yui-gd div.first{*margin-right:0;}.yui-gb .yui-gb .yui-u,.yui-gb .yui-gc .yui-u{*margin-left:1.8%;_margin-left:4%;}.yui-g .yui-gb .yui-u{_margin-left:1.0%;}.yui-gb .yui-gd .yui-u{*width:66%;_width:61.2%;}.yui-gb .yui-gd div.first{*width:31%;_width:29.5%;}.yui-g .yui-gc .yui-u,.yui-gb .yui-gc .yui-u{width:32%;_float:right;margin-right:0;_margin-left:0;}.yui-gb .yui-gc div.first{width:66%;*float:left;*margin-left:0;}.yui-gb .yui-ge .yui-u,.yui-gb .yui-gf .yui-u{margin:0;}.yui-gb .yui-gb .yui-u{_margin-left:.7%;}.yui-gb .yui-g div.first,.yui-gb .yui-gb div.first{*margin-left:0;}.yui-gc .yui-g .yui-u,.yui-gd .yui-g .yui-u{*width:48.1%;*margin-left:0;} .yui-gb .yui-gd div.first{width:32%;}.yui-g .yui-gd div.first{_width:29.9%;}.yui-ge .yui-g{width:24%;}.yui-gf .yui-g{width:74.2%;}.yui-gb .yui-ge div.yui-u,.yui-gb .yui-gf div.yui-u{float:right;}.yui-gb .yui-ge div.first,.yui-gb .yui-gf div.first{float:left;}.yui-gb .yui-ge .yui-u,.yui-gb .yui-gf div.first{*width:24%;_width:20%;}.yui-gb .yui-ge div.first,.yui-gb .yui-gf .yui-u{*width:73.5%;_width:65.5%;}.yui-ge div.first .yui-gd .yui-u{width:65%;}.yui-ge div.first .yui-gd div.first{width:32%;}#bd:after,.yui-g:after,.yui-gb:after,.yui-gc:after,.yui-gd:after,.yui-ge:after,.yui-gf:after{content:".";display:block;height:0;clear:both;visibility:hidden;}#bd,.yui-g,.yui-gb,.yui-gc,.yui-gd,.yui-ge,.yui-gf{zoom:1;}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<?xml version="1.0"?>
|
2
|
-
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
|
3
|
-
<ShortName><%= application_name %></ShortName>
|
4
|
-
<Description><%= application_name %> Search</Description>
|
5
|
-
<Image height="16" width="16" type="image/x-icon">/favicon.ico</Image>
|
6
|
-
<Contact/>
|
7
|
-
<Url type="text/html" method="get" template="<%= url_for :controller=>'catalog', :only_path => false %>?q={searchTerms}"/>
|
8
|
-
<Url type="application/rss+xml" method="get" template="<%= url_for :controller=>'catalog', :only_path => false %>.rss?q={searchTerms}"/>
|
9
|
-
<Url type="application/atom+xml" method="get" template="<%= url_for :controller=>'catalog', :only_path => false %>.atom?q={searchTerms}"/>
|
10
|
-
<Url type="application/x-suggestions+json" method="get" template="<%= url_for :controller=>'catalog',:action => 'opensearch', :format=> 'json', :only_path => false %>?q={searchTerms}"/>
|
11
|
-
</OpenSearchDescription>
|
data/doc/Atom-Responses.md
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
Blacklight will provide atom responses for all catalog/index results. Just add ".atom" on to the end of your path component, `/catalog.atom`, or `/catalog/index.atom`.
|
2
|
-
```xml
|
3
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
4
|
-
<feed xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns="http://www.w3.org/2005/Atom">
|
5
|
-
<title>Blacklight Search Results</title>
|
6
|
-
<author>
|
7
|
-
<name>Blacklight</name>
|
8
|
-
</author>
|
9
|
-
<link href="http://demo.projectblacklight.org/?commit=search&amp;format=atom&amp;q=urdu&amp;search_field=all_fields" rel="self"/>
|
10
|
-
<link href="http://demo.projectblacklight.org/?commit=search&amp;format=html&amp;q=urdu&amp;search_field=all_fields" rel="alternate" type="text/html"/>
|
11
|
-
<id>http://demo.projectblacklight.org/?commit=search&amp;format=html&amp;q=urdu&amp;search_field=all_fields&amp;type=text%2Fhtml</id>
|
12
|
-
<link href="http://demo.projectblacklight.org/?commit=search&amp;format=atom&amp;page=2&amp;q=urdu&amp;search_field=all_fields" rel="next"/>
|
13
|
-
<link href="http://demo.projectblacklight.org/?commit=search&amp;format=atom&amp;page=1&amp;q=urdu&amp;search_field=all_fields" rel="first"/>
|
14
|
-
<link href="http://demo.projectblacklight.org/?commit=search&amp;format=atom&amp;page=15&amp;q=urdu&amp;search_field=all_fields" rel="last"/>
|
15
|
-
<link href="http://demo.projectblacklight.org/catalog/opensearch.xml" rel="search" type="application/opensearchdescription+xml"/>
|
16
|
-
<opensearch:totalResults>147</opensearch:totalResults>
|
17
|
-
<opensearch:startIndex>0</opensearch:startIndex>
|
18
|
-
<opensearch:itemsPerPage>10</opensearch:itemsPerPage>
|
19
|
-
<opensearch:Query searchTerms="urdu" startPage="1" role="request"/>
|
20
|
-
<updated>2011-05-11T17:46:58Z</updated>
|
21
|
-
<entry>
|
22
|
-
<title>Urdū ḍrāmā</title>
|
23
|
-
<updated>2011-05-11T17:46:58Z</updated>
|
24
|
-
<link href="http://demo.projectblacklight.org/catalog/2008306442" rel="alternate" type="text/html"/>
|
25
|
-
<link href="http://demo.projectblacklight.org/catalog/2008306442.dc_xml" rel="alternate" title="dc_xml" type="text/xml" />
|
26
|
-
<link href="http://demo.projectblacklight.org/catalog/2008306442.xml" rel="alternate" title="xml" type="application/xml" />
|
27
|
-
<id>http://demo.projectblacklight.org/catalog/2008306442</id>
|
28
|
-
<author>
|
29
|
-
<name>Farg̲h̲ānah, 1979-</name>
|
30
|
-
</author>
|
31
|
-
<summary type="html">
|
32
|
-
<dl class="defList">
|
33
|
-
|
34
|
-
|
35
|
-
<dt class="blacklight-title_display">Title:</dt>
|
36
|
-
<dd class="blacklight-title_display">Urdū ḍrāmā</dd>
|
37
|
-
|
38
|
-
<dt class="blacklight-author_display">Author:</dt>
|
39
|
-
<dd class="blacklight-author_display">Farg̲h̲ānah, 1979-</dd>
|
40
|
-
|
41
|
-
|
42
|
-
<!-- [...] -->
|
43
|
-
</dl>
|
44
|
-
</summary>
|
45
|
-
</entry>
|
46
|
-
<!-- [...] -->
|
47
|
-
</feed>
|
48
|
-
```
|
49
|
-
|
50
|
-
|
51
|
-
The same HTML summary included in your HTML results pages are included as an `atom:summary` element -- the atom template uses the `[[#render_document_partial|https://github.com/projectblacklight/blacklight/blob/master/app/helpers/blacklight_helper.rb#L311]]` helper method to generate this HTML summary, so if you've over-ridden that for your app, it will be used as the `atom:summary` content instead.
|
52
|
-
|
53
|
-
## API Usage
|
54
|
-
The Atom response is intended to be pretty full of data, so it can fill many traditional API requests. It makes use of every relevant atom or [[OpenSearch|http://www.opensearch.org/Home]] element that could be conveniently included.
|
55
|
-
|
56
|
-
The Atom response also supports arbitrary format representations in the `atom:content` element. You can include `&content_format=some_format` in your request URL (e.g. `[[/catalog.atom?content_format=oai_dc_xml|http://demo.projectblacklight.org/catalog.atom?q=urdu&content_format=oai_dc_xml]]`). Any format a given document can be exported as using the [[Blacklight document framework|Extending-blacklight-with-the-document-extension-framework]] is available. Not every document can export in every format -- if a format is requested one or more of the items in your atom result can not export as, it will not have an `atom:content` element. Non-XML-based formats are supported, as the content is Base64-encoded (as per Atom spec, unless the format is `text/plain`).
|
57
|
-
```xml
|
58
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
59
|
-
<feed xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns="http://www.w3.org/2005/Atom">
|
60
|
-
<title>Blacklight Search Results</title>
|
61
|
-
<author>
|
62
|
-
<name>Blacklight</name>
|
63
|
-
</author>
|
64
|
-
<link href="http://demo.projectblacklight.org/?content_format=oai_dc_xml&amp;format=atom&amp;per_page=1" rel="self"/>
|
65
|
-
<!-- [...] -->
|
66
|
-
<entry>
|
67
|
-
<title>The book of the dance in the 20th century selections from the Jane Bourne Parton collection of books on the dance</title>
|
68
|
-
<updated>2011-05-11T17:59:32Z</updated>
|
69
|
-
<link href="http://demo.projectblacklight.org/catalog/u1" rel="alternate" type="text/html"/>
|
70
|
-
<link href="http://demo.projectblacklight.org/catalog/u1.dc_xml" rel="alternate" title="dc_xml" type="text/xml" />
|
71
|
-
<link href="http://demo.projectblacklight.org/catalog/u1.xml" rel="alternate" title="xml" type="application/xml" />
|
72
|
-
<id>http://demo.projectblacklight.org/catalog/u1</id>
|
73
|
-
<author>
|
74
|
-
<name>Roatcap, Adela Spindler</name>
|
75
|
-
</author>
|
76
|
-
<summary type="html">
|
77
|
-
<!-- [...] -->
|
78
|
-
</summary>
|
79
|
-
<!-- [ Here is the export format as OAI Dublin Core XML ] -->
|
80
|
-
<content type="text/xml">
|
81
|
-
<oai_dc:dc xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dc:language>English</dc:language><dc:title>The book of the dance in the 20th century selections from the Jane Bourne Parton collection of books on the dance</dc:title><dc:format>Book</dc:format></oai_dc:dc> </content>
|
82
|
-
</entry>
|
83
|
-
</feed>
|
84
|
-
```
|
85
|
-
|
86
|
-
This means that if you add on a document extension that provides more export formats for some or all of your documents, that will automatically be available in the atom response.
|
87
|
-
|
88
|
-
If you choose to use the [[Blacklight CQL add-on|https://github.com/projectblacklight/blacklight_cql]], the combination of [[CQL|http://www.loc.gov/standards/sru/specs/cql.html]] requests and Atom responses provides a pretty good more-or-less standards-based API to search results through Blacklight.
|
89
|
-
|
90
|
-
The Atom response generating template is at `app/views/catalog/index.builder.atom`.
|
data/doc/CUSTOMIZING.md
DELETED
@@ -1,121 +0,0 @@
|
|
1
|
-
# Customizing Blacklight
|
2
|
-
|
3
|
-
There are lots of way to override specific behaviors and views in Blacklight. Blacklight is distributed as a Ruby gem with a Rails Engine framework built in. All customization of Blacklight behavior should be done within your application (partly as good practice, but also to not lose your changes with every new Blacklight release).
|
4
|
-
|
5
|
-
If you find that there is no other way to make your customization, please describe your problem on the [[mailing list|http://groups.google.com/group/blacklight-development]] -- we'll do the best we can to help out, and even make changes to Blacklight as needed. If you are interested in contributing code to Blacklight, see the [[Contributing to Blacklight]] page.
|
6
|
-
|
7
|
-
## Layouts
|
8
|
-
|
9
|
-
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.
|
10
|
-
|
11
|
-
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.
|
12
|
-
|
13
|
-
```ruby
|
14
|
-
def layout_name
|
15
|
-
"application"
|
16
|
-
end
|
17
|
-
```
|
18
|
-
|
19
|
-
When implmeenting 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. An example would be insertion of alternate format auto-discovery link tags in the head section; if you call out to BL helpers, BL will make sure it happens. Another example would be the sidebar_items helper; if you don't call out to that, your page won't include sidebar content such as facet lists.
|
20
|
-
|
21
|
-
## Overriding Views (templates and partials)
|
22
|
-
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.
|
23
|
-
|
24
|
-
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.
|
25
|
-
|
26
|
-
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.
|
27
|
-
|
28
|
-
## Overriding the Catalog controller
|
29
|
-
Overriding the Blacklight CatalogController implementation is easy, and the skeleton of the `CatalogController` is generated into your application for you when you install Blacklight.
|
30
|
-
|
31
|
-
See the [[Extending or Modifying Blacklight Search Behavior]] for tips and approaches to customizing the catalog.
|
32
|
-
|
33
|
-
## Overriding Other Controllers
|
34
|
-
|
35
|
-
1. Find the controller you're interested in in blacklight's app/controllers/ .
|
36
|
-
2. Create a file with the same name in your local app/controllers.
|
37
|
-
3. This file requires the original class, and then re-opens it to add more methods.
|
38
|
-
|
39
|
-
```ruby
|
40
|
-
require "#{Blacklight.controllers_dir}/some_controller"
|
41
|
-
|
42
|
-
class SomeController < ApplicationController
|
43
|
-
# custom code goes here
|
44
|
-
end
|
45
|
-
```
|
46
|
-
|
47
|
-
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.
|
48
|
-
|
49
|
-
It's kind of hard to call 'super' to call original functionality:
|
50
|
-
|
51
|
-
* the ruby language features here make 'super' unavailable, although you can work around that confusingly with the rails #alias_method_chain method.
|
52
|
-
* 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.
|
53
|
-
|
54
|
-
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.
|
55
|
-
|
56
|
-
|
57
|
-
## Custom View Helpers
|
58
|
-
|
59
|
-
(This is accurate for Blacklight 3.1.1 and subsequent. Before that, things were messier).
|
60
|
-
|
61
|
-
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.
|
62
|
-
|
63
|
-
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).
|
64
|
-
|
65
|
-
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.
|
66
|
-
|
67
|
-
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:
|
68
|
-
|
69
|
-
```ruby
|
70
|
-
module BlacklightHelper
|
71
|
-
include Blacklight::BlacklightHelperBehavior
|
72
|
-
end
|
73
|
-
```
|
74
|
-
|
75
|
-
Now, the actual methods will be found in app/helpers/blacklight/blacklight_helper_behavior.rb instead.
|
76
|
-
|
77
|
-
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 BlacklightHelpersBehavior, and the other methods you don't over-ride will still have their default implementation.
|
78
|
-
|
79
|
-
YOUR `app/helpers/blacklight_helper.rb`
|
80
|
-
|
81
|
-
```ruby
|
82
|
-
module BlacklightHelper
|
83
|
-
include Blacklight::BlacklightHelperBehavior
|
84
|
-
|
85
|
-
def application_name
|
86
|
-
"Bestest University Search"
|
87
|
-
end
|
88
|
-
end
|
89
|
-
```
|
90
|
-
|
91
|
-
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.
|
92
|
-
|
93
|
-
## Adding in your own CSS or Javascript
|
94
|
-
|
95
|
-
You probably already have a local `app/controllers/application_controller.rb`. If you've installed the Blacklight plugin already, it probably looks something like this:
|
96
|
-
```ruby
|
97
|
-
class ApplicationController < ActionController::Base
|
98
|
-
# Adds a few additional behaviors into the application controller
|
99
|
-
include Blacklight::Controller
|
100
|
-
end
|
101
|
-
```
|
102
|
-
|
103
|
-
Now create a css file called whatever you want in the application's `./public/stylesheets` directory inside the class definition, add like so:
|
104
|
-
```ruby
|
105
|
-
class ApplicationController < ActionController::Base
|
106
|
-
before_filter :add_my_own_assets
|
107
|
-
|
108
|
-
protected
|
109
|
-
def add_my_own_assets
|
110
|
-
stylesheet_links << "my_css"
|
111
|
-
|
112
|
-
# You can do something similar with javascript files too:
|
113
|
-
# javascript_includes << "my_js"
|
114
|
-
end
|
115
|
-
end
|
116
|
-
```
|
117
|
-
|
118
|
-
## See also
|
119
|
-
|
120
|
-
* [[Extending or Modifying Blacklight Search Behavior]]
|
121
|
-
* [[Pagination]]
|
@@ -1 +0,0 @@
|
|
1
|
-
See [[Blacklight::Solr::Document rdoc|http://rdoc.info/github/projectblacklight/blacklight/master/Blacklight/Solr/Document]]
|
@@ -1,131 +0,0 @@
|
|
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 `[[./config/initializers/blacklight_config.rb|https://github.com/projectblacklight/blacklight/blob/master/lib/generators/blacklight/templates/config/blacklight_config.rb]]`.
|
40
|
-
|
41
|
-
Nothing special about the filename 'blacklight_config.rb', anything in a Rails app at `./config/initializers/*.rb` gets run on application startup, what matters it the code.
|
42
|
-
|
43
|
-
## Application logic
|
44
|
-
|
45
|
-
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).
|
46
|
-
|
47
|
-
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. We 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.
|
48
|
-
|
49
|
-
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.
|
50
|
-
|
51
|
-
The default `#solr_search_params_logic` is meant to handle very common cases and patterns based on simple configuration options, usually set in the `config/blacklight_config.rb` file, and the user-supplied URL parameters.
|
52
|
-
|
53
|
-
* `[[Blacklight.config[:default_solr_params]|https://github.com/projectblacklight/blacklight/blob/master/config/initializers/blacklight_config.rb#L44]]`
|
54
|
-
* 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.
|
55
|
-
* `[[Blacklight.config[:search_fields]|https://github.com/projectblacklight/blacklight/blob/master/config/initializers/blacklight_config.rb#L194]]`
|
56
|
-
* An array of hashes, each of which defines a 'search field' which 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.
|
57
|
-
* 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.
|
58
|
-
* 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.
|
59
|
-
* 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.
|
60
|
-
|
61
|
-
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.
|
62
|
-
|
63
|
-
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.
|
64
|
-
|
65
|
-
|
66
|
-
# Extending Blacklight::SolrHelper#solr_search_params
|
67
|
-
|
68
|
-
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.
|
69
|
-
|
70
|
-
`#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.
|
71
|
-
|
72
|
-
You can add custom solr_search_params_logic steps within the `blacklight_config.rb` (or in many other places) by adding a Symbol with the name of a method (provided by the controller) you wish to use, e.g.:
|
73
|
-
|
74
|
-
*./config/initializers/blacklight_config.rb*
|
75
|
-
|
76
|
-
```ruby
|
77
|
-
CatalogController.solr_search_params_logic << :show_only_public_records
|
78
|
-
```
|
79
|
-
(note, this method of using an initiailizer has trouble if the local CatalogController is reloaded with Rails development-mode class reloading, it'll miss the mod to solr_search_params_logic on reload. To get around this, either use `to_prepare do`, or just mod the solr_search_params_logic in the local CatalogController class definition, as below)
|
80
|
-
|
81
|
-
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:
|
82
|
-
|
83
|
-
*./app/controllers/catalog_controller.rb*
|
84
|
-
|
85
|
-
```ruby
|
86
|
-
require 'blacklight/catalog'
|
87
|
-
class CatalogController < ApplicationController
|
88
|
-
include Blacklight::Catalog
|
89
|
-
include MyApplication::SolrHelper::Authorization
|
90
|
-
|
91
|
-
# Instead of defining this within an initializer, you may instead wish to do it on the controller directly:
|
92
|
-
# self.solr_search_params_logic << :show_only_public_records
|
93
|
-
|
94
|
-
# You could also define the actual method here, but this is not recommended.
|
95
|
-
# def show_only_public_records solr_parameters, user_parameters
|
96
|
-
# [...]
|
97
|
-
# end
|
98
|
-
end
|
99
|
-
```
|
100
|
-
|
101
|
-
The included module then defines the logic method:
|
102
|
-
|
103
|
-
*./lib/my_application/solr_helper/authorization.rb*
|
104
|
-
|
105
|
-
```ruby
|
106
|
-
module MyApplication::SolrHelper::Authorization
|
107
|
-
# You could also add the logic here
|
108
|
-
# def self.included base
|
109
|
-
# base.solr_search_params_logic << :show_only_public_records
|
110
|
-
# end
|
111
|
-
|
112
|
-
# solr_search_params_logic methods take two arguments
|
113
|
-
# @param [Hash] solr_parameters a hash of parameters to be sent to Solr (via RSolr)
|
114
|
-
# @param [Hash] user_parameters a hash of user-supplied parameters (often via `params`)
|
115
|
-
def show_only_public_records solr_parameters, user_parameters
|
116
|
-
# add a new solr facet query ('fq') parameter that limits results to those with a 'public_b' field of 1
|
117
|
-
solr_parameters[:fq] ||= []
|
118
|
-
solr_parameters[:fq] << 'public_b:1'
|
119
|
-
end
|
120
|
-
end
|
121
|
-
```
|
122
|
-
|
123
|
-
## Other examples
|
124
|
-
|
125
|
-
In addition to providing this behavior locally, some Blacklight plugins also extend the `#solr_search_params`:
|
126
|
-
|
127
|
-
* [[Blacklight Range Limit|https://github.com/projectblacklight/blacklight_range_limit/blob/master/lib/blacklight_range_limit/controller_override.rb]]
|
128
|
-
|
129
|
-
* A walk through on adding a checkbox limit at: http://bibwild.wordpress.com/2011/06/13/customing-blacklight-a-limit-checkbox/
|
130
|
-
|
131
|
-
* 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/
|
data/doc/Features.md
DELETED
@@ -1,147 +0,0 @@
|
|
1
|
-
## Discovery
|
2
|
-
### Search Features
|
3
|
-
Blacklight uses Solr as its "search engine". More information about Solr is available at the [[Solr web site|http://lucene.apache.org/solr/]]
|
4
|
-
|
5
|
-
* 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]]
|
6
|
-
[[https://github.com/projectblacklight/projectblacklight.github.com/raw/master/images/search_fields.png|frame|alt=Search fields in action]]
|
7
|
-
|
8
|
-
```ruby
|
9
|
-
# Now we see how to over-ride Solr request handler defaults, in this
|
10
|
-
# case for a BL "search field", which is really a dismax aggregate
|
11
|
-
# of Solr search fields.
|
12
|
-
config[:search_fields] << {
|
13
|
-
:key => 'title',
|
14
|
-
# solr_parameters hash are sent to Solr as ordinary url query params.
|
15
|
-
:solr_parameters => {
|
16
|
-
:"spellcheck.dictionary" => "title"
|
17
|
-
},
|
18
|
-
# :solr_local_parameters will be sent using Solr LocalParams
|
19
|
-
# syntax, as eg {! qf=$title_qf }. This is neccesary to use
|
20
|
-
# Solr parameter de-referencing like $title_qf.
|
21
|
-
# See: http://wiki.apache.org/solr/LocalParams
|
22
|
-
:solr_local_parameters => {
|
23
|
-
:qf => "$title_qf",
|
24
|
-
:pf => "$title_pf"
|
25
|
-
}
|
26
|
-
}
|
27
|
-
```
|
28
|
-
|
29
|
-
> Source: [[./config/initializers/blacklight_config.rb|https://github.com/projectblacklight/blacklight/blob/master/lib/generators/blacklight/templates/config/blacklight_config.rb#L155]]
|
30
|
-
|
31
|
-
|
32
|
-
- Faceted search allows users to constrain searches by controlled vocabulary items
|
33
|
-
[[https://github.com/projectblacklight/projectblacklight.github.com/raw/master/images/search_facets.png|frame|alt=Search facets in action]]
|
34
|
-
|
35
|
-
```ruby
|
36
|
-
# solr fields that will be treated as facets by the blacklight application
|
37
|
-
# The ordering of the field names is the order of the display
|
38
|
-
# TODO: Reorganize facet data structures supplied in config to make simpler
|
39
|
-
# for human reading/writing, kind of like search_fields. Eg,
|
40
|
-
# config[:facet] << {:field_name => "format", :label => "Format", :limit => 10}
|
41
|
-
config[:facet] = {
|
42
|
-
:field_names => (facet_fields = [
|
43
|
-
"format",
|
44
|
-
"pub_date",
|
45
|
-
"subject_topic_facet",
|
46
|
-
"language_facet",
|
47
|
-
"lc_1letter_facet",
|
48
|
-
"subject_geo_facet",
|
49
|
-
"subject_era_facet"
|
50
|
-
]),
|
51
|
-
:labels => {
|
52
|
-
"format" => "Format",
|
53
|
-
"pub_date" => "Publication Year",
|
54
|
-
"subject_topic_facet" => "Topic",
|
55
|
-
"language_facet" => "Language",
|
56
|
-
"lc_1letter_facet" => "Call Number",
|
57
|
-
"subject_era_facet" => "Era",
|
58
|
-
"subject_geo_facet" => "Region"
|
59
|
-
},
|
60
|
-
# Setting a limit will trigger Blacklight's 'more' facet values link.
|
61
|
-
# * If left unset, then all facet values returned by solr will be displayed.
|
62
|
-
# * If set to an integer, then "f.somefield.facet.limit" will be added to
|
63
|
-
# solr request, with actual solr request being +1 your configured limit --
|
64
|
-
# you configure the number of items you actually want _displayed_ in a page.
|
65
|
-
# * If set to 'true', then no additional parameters will be sent to solr,
|
66
|
-
# but any 'sniffed' request limit parameters will be used for paging, with
|
67
|
-
# paging at requested limit -1. Can sniff from facet.limit or
|
68
|
-
# f.specific_field.facet.limit solr request params. This 'true' config
|
69
|
-
# can be used if you set limits in :default_solr_params, or as defaults
|
70
|
-
# on the solr side in the request handler itself. Request handler defaults
|
71
|
-
# sniffing requires solr requests to be made with "echoParams=all", for
|
72
|
-
# app code to actually have it echo'd back to see it.
|
73
|
-
:limits => {
|
74
|
-
"subject_topic_facet" => 20,
|
75
|
-
"language_facet" => true
|
76
|
-
}
|
77
|
-
}
|
78
|
-
```
|
79
|
-
|
80
|
-
> Source: [[./config/initializers/blacklight_config.rb|https://github.com/projectblacklight/blacklight/blob/master/lib/generators/blacklight/templates/config/blacklight_config.rb#L39]]
|
81
|
-
|
82
|
-
* Blacklight provides basic spellcheck suggestions for poor search queries
|
83
|
-
[[https://github.com/projectblacklight/projectblacklight.github.com/raw/master/images/search_spellcheck.png|frame|alt=Spellchecking user queries]]
|
84
|
-
|
85
|
-
* Blacklight provides flexible mapping from user queries to solr parameters, which are easily overridable in local applications (see [[Extending or Modifying Blacklight Search Behavior]]).
|
86
|
-
|
87
|
-
```ruby
|
88
|
-
# Each symbol identifies a _method_ that must be in
|
89
|
-
# this class, taking two parameters (solr_parameters, user_parameters)
|
90
|
-
# Can be changed in local apps or by plugins, eg:
|
91
|
-
# CatalogController.include ModuleDefiningNewMethod
|
92
|
-
# CatalogController.solr_search_params_logic << :new_method
|
93
|
-
# CatalogController.solr_search_params_logic.delete(:we_dont_want)
|
94
|
-
self.solr_search_params_logic = [:default_solr_parameters , :add_query_to_solr, :add_facet_fq_to_solr, :add_facetting_to_solr, :add_sorting_paging_to_solr ]
|
95
|
-
```
|
96
|
-
|
97
|
-
> Source: [[./lib/blacklight/solr_helper.rb|https://github.com/projectblacklight/blacklight/blob/master/lib/blacklight/solr_helper.rb#L70]]
|
98
|
-
|
99
|
-
|
100
|
-
### Other
|
101
|
-
- Stable URLs allow users to bookmark, share, and save search queries for later access
|
102
|
-
- Recent searches are saved in the Search History for quick access to previous queries
|
103
|
-
- Folder + Bookmarks allow users to collect and keep track of items as they browse
|
104
|
-
- Every Blacklight search provides RSS and [[Atom Responses]] of search results
|
105
|
-
- Blacklight supports [[OpenSearch|http://www.opensearch.org/Home]], a collection of simple formats for the sharing of search results. The OpenSearch description document format can be used to describe a search engine so that it can be used by search client applications. The OpenSearch response elements can be used to extend existing syndication formats, such as RSS and Atom, with the extra metadata needed to return search results. (From OpenSearch Introduction)
|
106
|
-
|
107
|
-
## Access
|
108
|
-
### Export
|
109
|
-
- Cite
|
110
|
-
- Refworks
|
111
|
-
- Endnote
|
112
|
-
- Email
|
113
|
-
- SMS
|
114
|
-
- Librarian View
|
115
|
-
|
116
|
-
For compatible records, an [[OpenURL/Z39.88 COinS|http://www.zotero.org/support/dev/making_coins]] object is embedded in each document, which allows plugins like Zotero to easily extract data from the page.
|
117
|
-
|
118
|
-
### Semantic Fields
|
119
|
-
|
120
|
-
### Document Extension Framework
|
121
|
-
|
122
|
-
The main use case for extensions is for transforming a Document to another
|
123
|
-
format. Either to another type of Ruby object, or to an exportable string in
|
124
|
-
a certain format.
|
125
|
-
|
126
|
-
An Blacklight::Solr::Document extension is simply a ruby module which is mixed
|
127
|
-
in to individual Document instances. The intended use case is for documents
|
128
|
-
containing some particular format of source material, such as Marc. An
|
129
|
-
extension can be registered with your document class, along with a block
|
130
|
-
containing custom logic for which documents to apply the extension to.
|
131
|
-
|
132
|
-
```ruby
|
133
|
-
SolrDocument.use_extension(MyExtension) {|document| my_logic_on_document(document}
|
134
|
-
```
|
135
|
-
|
136
|
-
MyExtension will be mixed-in (using ruby 'extend') only to those documents
|
137
|
-
where the block results in true.
|
138
|
-
|
139
|
-
Underlying metadata formats, or other alternative document views, are linked to from the HTML page <head>.
|
140
|
-
|
141
|
-
### Data Formats
|
142
|
-
MaRC
|
143
|
-
|
144
|
-
## Testing
|
145
|
-
|
146
|
-
|
147
|
-
Additional features are available through [[Blacklight Add-ons]].
|