sufia 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.travis.yml +6 -0
- data/Gemfile +5 -2
- data/History.md +6 -0
- data/README.md +40 -0
- data/Rakefile +4 -0
- data/app/assets/javascripts/sufia.js +3 -115
- data/app/assets/javascripts/sufia/batch_select_all.js +179 -0
- data/app/assets/javascripts/sufia/edit_metadata.js +86 -0
- data/app/assets/javascripts/sufia/multiForm.js +57 -0
- data/app/assets/javascripts/terms_of_service.js +7 -0
- data/app/assets/stylesheets/audio-js.css +3 -0
- data/app/assets/stylesheets/dashboard.css.scss +51 -0
- data/app/assets/stylesheets/generic_files.css +36 -0
- data/app/assets/stylesheets/sufia.css.scss +2 -0
- data/app/controllers/batch_controller.rb +11 -0
- data/app/controllers/batch_edits_controller.rb +1 -77
- data/app/controllers/generic_files_controller.rb +1 -0
- data/app/controllers/mailbox_controller.rb +1 -1
- data/app/controllers/single_use_link_controller.rb +11 -7
- data/app/helpers/generic_file_helper.rb +11 -3
- data/app/helpers/sufia_helper.rb +13 -10
- data/app/models/batch.rb +1 -1
- data/app/models/datastreams/fits_datastream.rb +2 -2
- data/app/models/datastreams/generic_file_rdf_datastream.rb +22 -18
- data/app/models/datastreams/properties_datastream.rb +2 -2
- data/app/views/_user_util_links.html.erb +2 -2
- data/app/views/batch/_metadata.html.erb +82 -0
- data/app/views/batch/_more_metadata.html.erb +6 -0
- data/app/views/batch/edit.html.erb +1 -8
- data/app/views/batch_edits/_check_all.html.erb +0 -157
- data/app/views/batch_edits/edit.html.erb +0 -29
- data/app/views/catalog/_index_partials/_list_files.html.erb +8 -10
- data/app/views/catalog/_recent_document.html.erb +9 -18
- data/app/views/catalog/_results_pagination.html.erb +1 -1
- data/app/views/contact_form/new.html.erb +1 -1
- data/app/views/dashboard/_index_partials/_default_group.html.erb +1 -1
- data/app/views/dashboard/_index_partials/_list_files.html.erb +12 -14
- data/app/views/dashboard/_index_partials/_thumbnail_display.html.erb +9 -19
- data/app/views/dashboard/_results_pagination.html.erb +1 -1
- data/app/views/dashboard/index.html.erb +6 -82
- data/app/views/error/single_use_error.html.erb +35 -0
- data/app/views/generic_files/_descriptions.html.erb +2 -2
- data/app/views/generic_files/_extra_fields_modal.html.erb +1 -1
- data/app/views/generic_files/_field_form.html.erb +2 -5
- data/app/views/generic_files/_media_display.html.erb +8 -6
- data/app/views/generic_files/_permission.html.erb +2 -2
- data/app/views/generic_files/_rights_modal.html.erb +1 -1
- data/app/views/generic_files/_show_actions.html.erb +1 -1
- data/app/views/generic_files/_show_details.html.erb +11 -6
- data/app/views/generic_files/edit.html.erb +0 -8
- data/app/views/generic_files/edit_fields/_type.html.erb +1 -1
- data/app/views/generic_files/show.html.erb +5 -8
- data/app/views/generic_files/show_fields/_based_near.html.erb +4 -1
- data/app/views/generic_files/show_fields/_contributor.html.erb +4 -1
- data/app/views/generic_files/show_fields/_creator.html.erb +4 -1
- data/app/views/generic_files/show_fields/_date_created.html.erb +4 -1
- data/app/views/generic_files/show_fields/_description.html.erb +4 -1
- data/app/views/generic_files/show_fields/_language.html.erb +1 -1
- data/app/views/generic_files/show_fields/_publisher.html.erb +4 -1
- data/app/views/generic_files/show_fields/_related_url.html.erb +3 -1
- data/app/views/generic_files/show_fields/_resource_type.html.erb +1 -1
- data/app/views/generic_files/show_fields/_subject.html.erb +4 -1
- data/app/views/generic_files/show_fields/_tag.html.erb +1 -1
- data/app/views/generic_files/show_fields/_title.html.erb +4 -1
- data/app/views/layouts/error.html.erb +0 -4
- data/app/views/layouts/hydra-head.html.erb +2 -6
- data/app/views/single_use_link/show.html.erb +1 -1
- data/app/views/users/index.html.erb +1 -1
- data/app/views/users/show.html.erb +1 -1
- data/config/locales/sufia.en.yml +1 -0
- data/config/routes.rb +11 -4
- data/lib/generators/sufia/sufia_generator.rb +2 -1
- data/lib/generators/sufia/templates/catalog_controller.rb +143 -117
- data/lib/generators/sufia/templates/config/resque_admin.rb +10 -0
- data/lib/generators/sufia/templates/config/sufia.rb +8 -0
- data/lib/sufia.rb +4 -14
- data/lib/sufia/batch_edits_controller_behavior.rb +89 -0
- data/lib/sufia/controller.rb +7 -5
- data/lib/sufia/downloads_controller_behavior.rb +14 -19
- data/lib/sufia/file_content/extract_metadata.rb +11 -4
- data/lib/sufia/files_controller_behavior.rb +63 -44
- data/lib/sufia/generic_file.rb +29 -11
- data/lib/sufia/generic_file/audit.rb +1 -1
- data/lib/sufia/generic_file/thumbnail.rb +51 -26
- data/lib/sufia/id_service.rb +28 -11
- data/lib/sufia/jobs/batch_update_job.rb +2 -2
- data/lib/sufia/jobs/characterize_job.rb +11 -3
- data/lib/sufia/jobs/ffmpeg_transcode_job.rb +61 -0
- data/lib/sufia/jobs/resolrize_job.rb +1 -1
- data/lib/sufia/jobs/transcode_audio_job.rb +40 -0
- data/lib/sufia/jobs/transcode_video_job.rb +9 -49
- data/lib/sufia/queue/resque.rb +2 -2
- data/lib/sufia/single_use_error.rb +4 -0
- data/lib/sufia/solr_document_behavior.rb +108 -1
- data/lib/sufia/version.rb +1 -1
- data/solr_conf/conf/schema.xml +332 -652
- data/solr_conf/conf/solrconfig.xml +60 -196
- data/spec/controllers/batch_controller_spec.rb +4 -5
- data/spec/controllers/catalog_controller_spec.rb +13 -13
- data/spec/controllers/dashboard_controller_spec.rb +2 -2
- data/spec/controllers/downloads_controller_spec.rb +74 -62
- data/spec/controllers/generic_files_controller_spec.rb +10 -8
- data/spec/controllers/single_use_link_controller_spec.rb +12 -4
- data/spec/fixtures/Example.ogg +0 -0
- data/spec/fixtures/piano_note.wav +0 -0
- data/spec/fixtures/sufia_generic_stub.descMeta.txt +1 -1
- data/spec/helpers/sufia_helper_spec.rb +12 -0
- data/spec/models/characterize_job_spec.rb +89 -0
- data/spec/models/checksum_audit_log_spec.rb +1 -0
- data/spec/models/event_jobs_spec.rb +9 -9
- data/spec/models/file_content_datastream_spec.rb +16 -10
- data/spec/models/fits_datastream_spec.rb +2 -8
- data/spec/models/generic_file_spec.rb +131 -60
- data/spec/models/solr_document_spec.rb +21 -0
- data/spec/models/transcode_audio_job_spec.rb +81 -0
- data/spec/models/transcode_video_job_spec.rb +2 -2
- data/spec/models/unzip_job_spec.rb +3 -3
- data/spec/spec_helper.rb +21 -0
- data/spec/support/Gemfile +7 -3
- data/sufia.gemspec +8 -11
- data/tasks/cucumber.rake +1 -2
- data/tasks/sufia-dev.rake +13 -2
- data/tasks/sufia.rake +1 -1
- metadata +77 -118
- data/app/views/batch_edits/_metadata.html.erb +0 -180
- data/lib/generators/sufia/templates/config/hydra_config.rb +0 -32
- data/lib/kaminari/helpers/tag.rb +0 -11
@@ -2,7 +2,10 @@
|
|
2
2
|
<th>Location</th>
|
3
3
|
<td>
|
4
4
|
<% @generic_file.based_near.each do |bn| %>
|
5
|
-
|
5
|
+
<span itemprop="contentLocation" itemscope itemtype="http://schema.org/Place">
|
6
|
+
<span itemprop="name"><%= link_to_facet(bn, Solrizer.solr_name("desc_metadata__based_near", :facetable)) %></span>
|
7
|
+
</span>
|
8
|
+
<br />
|
6
9
|
<% end %>
|
7
10
|
</td>
|
8
11
|
</tr>
|
@@ -2,7 +2,10 @@
|
|
2
2
|
<th>Contributor</th>
|
3
3
|
<td>
|
4
4
|
<% @generic_file.contributor.each do |contributor| %>
|
5
|
-
|
5
|
+
<span itemprop="contributor" itemscope itemtype="http://schema.org/Thing">
|
6
|
+
<span itemprop="name"><%= link_to_field('contributor', contributor) %></span>
|
7
|
+
</span>
|
8
|
+
<br />
|
6
9
|
<% end %>
|
7
10
|
</td>
|
8
11
|
</tr>
|
@@ -2,7 +2,10 @@
|
|
2
2
|
<th>Creator</th>
|
3
3
|
<td>
|
4
4
|
<% @generic_file.creator.each do |creator| %>
|
5
|
-
|
5
|
+
<span itemprop="creator" itemscope itemtype="http://schema.org/Thing">
|
6
|
+
<span itemprop="name"><%= link_to_facet(creator, Solrizer.solr_name("desc_metadata__creator", :facetable)) %></span>
|
7
|
+
</span>
|
8
|
+
<br />
|
6
9
|
<% end %>
|
7
10
|
</td>
|
8
11
|
</tr>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<th>Language</th>
|
3
3
|
<td>
|
4
4
|
<% @generic_file.language.each do |lang| %>
|
5
|
-
|
5
|
+
<span itemprop="inLanguage"><%= link_to_facet(lang, Solrizer.solr_name("desc_metadata__language", :facetable)) %></span><br />
|
6
6
|
<% end %>
|
7
7
|
</td>
|
8
8
|
</tr>
|
@@ -2,7 +2,10 @@
|
|
2
2
|
<th>Publisher</th>
|
3
3
|
<td>
|
4
4
|
<% @generic_file.publisher.each do |pub| %>
|
5
|
-
|
5
|
+
<span itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
|
6
|
+
<span itemprop="name"><%= link_to_facet(pub, Solrizer.solr_name("desc_metadata__publisher", :facetable)) %></span>
|
7
|
+
</span>
|
8
|
+
<br />
|
6
9
|
<% end %>
|
7
10
|
</td>
|
8
11
|
</tr>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<th>Resource Type</th>
|
3
3
|
<td>
|
4
4
|
<% @generic_file.resource_type.each do |rtype| %>
|
5
|
-
<%= link_to_facet(rtype,
|
5
|
+
<%= link_to_facet(rtype, Solrizer.solr_name("desc_metadata__resource_type", :facetable)) %><br />
|
6
6
|
<% end %>
|
7
7
|
</td>
|
8
8
|
</tr>
|
@@ -2,7 +2,10 @@
|
|
2
2
|
<th>Subject</th>
|
3
3
|
<td>
|
4
4
|
<% @generic_file.subject.each do |sub| %>
|
5
|
-
|
5
|
+
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
|
6
|
+
<span itemprop="name"><%= link_to_facet(sub, Solrizer.solr_name("desc_metadata__subject", :facetable)) %></span>
|
7
|
+
</span>
|
8
|
+
<br />
|
6
9
|
<% end %>
|
7
10
|
</td>
|
8
11
|
</tr>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<th>Keyword</th>
|
3
3
|
<td>
|
4
4
|
<% @generic_file.tag.each do |t| %>
|
5
|
-
|
5
|
+
<span itemprop="keywords"><%= link_to_facet(t, Solrizer.solr_name("desc_metadata__tag", :facetable)) %></span><br />
|
6
6
|
<% end %>
|
7
7
|
</td>
|
8
8
|
</tr>
|
@@ -39,10 +39,6 @@ limitations under the License.
|
|
39
39
|
</script>
|
40
40
|
|
41
41
|
<%= render :partial => '/ga', :formats => [:html] %>
|
42
|
-
|
43
|
-
<style type="text/css">
|
44
|
-
<%= yield(:local_css) %>
|
45
|
-
</style>
|
46
42
|
</head>
|
47
43
|
|
48
44
|
<%# need a better way to determine if we are on the home page and using three col layout %>
|
@@ -77,7 +73,7 @@ limitations under the License.
|
|
77
73
|
|
78
74
|
<div class="span30 offset2">
|
79
75
|
<h2 class="heading1">Contribute</h2>
|
80
|
-
<%= link_to
|
76
|
+
<%= link_to "<i class=\"icon-file\"></i> #{t('sufia.share_button')}".html_safe, sufia.new_generic_file_path, :class => "btn btn-primary btn-large", :id => "contribute_link" %>
|
81
77
|
<div class="row center"> <a href="/terms/">Terms of Use</a></div><br />
|
82
78
|
<div class="row"> </div>
|
83
79
|
<h2 class="heading1">My Latest</h2>
|
@@ -96,6 +92,6 @@ limitations under the License.
|
|
96
92
|
</div><!-- /.container -->
|
97
93
|
</div><!-- /#wrapper -->
|
98
94
|
<%= render partial: '/footer' %>
|
99
|
-
<div id="ajax-modal" class="modal hide
|
95
|
+
<div id="ajax-modal" class="modal hide" tabindex="-1"></div>
|
100
96
|
</body>
|
101
97
|
</html>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<table class="table table-striped"><!-- class="verticalheadings"> -->
|
11
11
|
<tbody>
|
12
12
|
<% @terms.each do |term| %>
|
13
|
-
<% vals = @generic_file.send(term) %>
|
13
|
+
<% vals = Array( @generic_file.send(term)) %>
|
14
14
|
<tr id='row_<%=term.to_s%>' class="expandable">
|
15
15
|
<th width="20%">
|
16
16
|
<%=get_label(term)%>
|
@@ -36,7 +36,7 @@ limitations under the License.
|
|
36
36
|
<td ><a href="<%= sufia.profile_path(URI.escape(user.user_key,'@.')) %>" ><%= user.name %><a></td>
|
37
37
|
<td><a href="<%= sufia.profile_path(URI.escape(user.user_key,'@.')) %>" ><%= user.user_key %><a></td>
|
38
38
|
<td><%= user.department %> </td>
|
39
|
-
<td><%= GenericFile.find(:
|
39
|
+
<td><%= GenericFile.find(:depositor => user.to_s).count %> </td>
|
40
40
|
</tr>
|
41
41
|
|
42
42
|
<% end %>
|
@@ -37,7 +37,7 @@ limitations under the License.
|
|
37
37
|
<dt><i class="icon-calendar"></i> Active Since</dt>
|
38
38
|
<dd><%= @user.created_at.to_date.to_formatted_s(:long_ordinal) %></dd>
|
39
39
|
<dt><i class="icon-folder-open"></i> Deposited Files</dt>
|
40
|
-
<dd><%= link_to_field('depositor', @user.to_s, GenericFile.
|
40
|
+
<dd><%= link_to_field('depositor', @user.to_s, GenericFile.where(:depositor => @user.to_s).count) %></dd>
|
41
41
|
<dt><i class="icon-trophy trophy-on" ></i> Highlighted Files</dt>
|
42
42
|
<% @trophies.each do |t| %>
|
43
43
|
<dd> <%= link_to display_title(t), sufia.generic_file_path(t) %></dd>
|
data/config/locales/sufia.en.yml
CHANGED
data/config/routes.rb
CHANGED
@@ -72,16 +72,23 @@ Sufia::Engine.routes.draw do
|
|
72
72
|
match 'contact' => 'contact_form#create', :via => :post, :as => :contact_form_index
|
73
73
|
match 'contact' => 'contact_form#new', :via => :get, :as => :contact_form_index
|
74
74
|
|
75
|
-
# Resque monitoring routes
|
76
|
-
|
77
|
-
|
78
|
-
|
75
|
+
# Resque monitoring routes. Don't bother with this route unless Sufia::ResqueAdmin
|
76
|
+
# has been defined in the initalizers.
|
77
|
+
if defined?(Sufia::ResqueAdmin)
|
78
|
+
namespace :admin do
|
79
|
+
constraints Sufia::ResqueAdmin do
|
80
|
+
mount Resque::Server, :at => "queues"
|
81
|
+
end
|
79
82
|
end
|
80
83
|
end
|
81
84
|
|
82
85
|
# Static page routes (workaround)
|
83
86
|
match ':action' => 'static#:action', :constraints => { :action => /about|help|terms|zotero|mendeley|agreement|subject_libraries|versions/ }, :as => :static
|
84
87
|
|
88
|
+
#Single use link errors
|
89
|
+
match 'single_use_link/not_found' => 'errors#single_use_error'
|
90
|
+
match 'single_use_link/expired' => 'errors#single_use_error'
|
91
|
+
|
85
92
|
# Catch-all (for routing errors)
|
86
93
|
match '*error' => 'errors#routing'
|
87
94
|
|
@@ -58,7 +58,7 @@ add_groups_to_users.rb create_local_authorities.rb create_trophies.rb}.each do
|
|
58
58
|
controller_name = "ApplicationController"
|
59
59
|
file_path = "app/controllers/application_controller.rb"
|
60
60
|
if File.exists?(file_path)
|
61
|
-
insert_into_file file_path, :after => 'include
|
61
|
+
insert_into_file file_path, :after => 'include Blacklight::Controller' do
|
62
62
|
" \n# Adds Sufia behaviors into the application controller \n" +
|
63
63
|
" include Sufia::Controller\n"
|
64
64
|
end
|
@@ -72,6 +72,7 @@ add_groups_to_users.rb create_local_authorities.rb create_trophies.rb}.each do
|
|
72
72
|
copy_file "config/sufia.rb", "config/initializers/sufia.rb"
|
73
73
|
copy_file "config/redis.yml", "config/redis.yml"
|
74
74
|
copy_file "config/redis_config.rb", "config/initializers/redis_config.rb"
|
75
|
+
copy_file "config/resque_admin.rb", "config/initializers/resque_admin.rb"
|
75
76
|
end
|
76
77
|
|
77
78
|
def catalog_controller
|
@@ -46,54 +46,30 @@ class CatalogController < ApplicationController
|
|
46
46
|
def recent
|
47
47
|
if user_signed_in?
|
48
48
|
# grab other people's documents
|
49
|
-
(
|
49
|
+
(_, @recent_documents) = get_search_results(:q =>filter_not_mine,
|
50
|
+
:sort=>sort_field, :rows=>4)
|
50
51
|
else
|
51
52
|
# grab any documents we do not know who you are
|
52
|
-
(
|
53
|
+
(_, @recent_documents) = get_search_results(:q =>'', :sort=>sort_field, :rows=>4)
|
53
54
|
end
|
54
|
-
@recent_documents = doc_list[0..3]
|
55
55
|
end
|
56
56
|
|
57
57
|
def recent_me
|
58
58
|
if user_signed_in?
|
59
|
-
(
|
60
|
-
|
61
|
-
else
|
62
|
-
@recent_user_documents = nil
|
59
|
+
(_, @recent_user_documents) = get_search_results(:q =>filter_not_mine,
|
60
|
+
:sort=>sort_field, :rows=>4)
|
63
61
|
end
|
64
62
|
end
|
65
63
|
|
64
|
+
def self.uploaded_field
|
65
|
+
# system_create_dtsi
|
66
|
+
solr_name('desc_metadata__date_uploaded', :stored_sortable, type: :date)
|
67
|
+
end
|
66
68
|
|
67
|
-
|
68
|
-
|
69
|
-
#####################
|
70
|
-
if Rails.env == "integration"
|
71
|
-
# COPIED AND MODIFIED from:
|
72
|
-
# /usr/local/rvm/gems/ree-1.8.7-2011.03@scholarsphere/gems/blacklight-3.3.2/lib/blacklight/catalog.rb
|
73
|
-
#
|
74
|
-
# when solr (RSolr) throws an error (RSolr::RequestError), this method is executed.
|
75
|
-
def rsolr_request_error(exception)
|
76
|
-
#if Rails.env == "development"
|
77
|
-
if ['development', 'integration'].include?(Rails.env)
|
78
|
-
raise exception # Rails own code will catch and give usual Rails error page with stack trace
|
79
|
-
else
|
80
|
-
flash_notice = "Sorry, I don't understand your search."
|
81
|
-
# Set the notice flag if the flash[:notice] is already set to the error that we are setting.
|
82
|
-
# This is intended to stop the redirect loop error
|
83
|
-
notice = flash[:notice] if flash[:notice] == flash_notice
|
84
|
-
unless notice
|
85
|
-
flash[:notice] = flash_notice
|
86
|
-
redirect_to root_path, :status => 500
|
87
|
-
else
|
88
|
-
render :template => "public/500.html", :layout => false, :status => 500
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
#
|
69
|
+
def self.modified_field
|
70
|
+
solr_name('desc_metadata__date_modified', :stored_sortable, type: :date)
|
93
71
|
end
|
94
|
-
|
95
|
-
# jgm testing end #
|
96
|
-
###################
|
72
|
+
|
97
73
|
|
98
74
|
configure_blacklight do |config|
|
99
75
|
## Default parameters to send to solr for all search-like requests. See also SolrHelper#solr_search_params
|
@@ -103,25 +79,24 @@ class CatalogController < ApplicationController
|
|
103
79
|
}
|
104
80
|
|
105
81
|
# solr field configuration for search results/index views
|
106
|
-
config.index.show_link = "
|
82
|
+
config.index.show_link = solr_name("desc_metadata__title", :displayable)
|
107
83
|
config.index.record_display_type = "id"
|
108
84
|
|
109
85
|
# solr field configuration for document/show views
|
110
|
-
config.show.html_title = "
|
111
|
-
config.show.heading = "
|
112
|
-
config.show.display_type = "
|
86
|
+
config.show.html_title = solr_name("desc_metadata__title", :displayable)
|
87
|
+
config.show.heading = solr_name("desc_metadata__title", :displayable)
|
88
|
+
config.show.display_type = solr_name("has_model", :symbol)
|
113
89
|
|
114
90
|
# solr fields that will be treated as facets by the blacklight application
|
115
91
|
# The ordering of the field names is the order of the display
|
116
|
-
config.add_facet_field "
|
117
|
-
|
118
|
-
config.add_facet_field "
|
119
|
-
config.add_facet_field "
|
120
|
-
config.add_facet_field "
|
121
|
-
config.add_facet_field "
|
122
|
-
config.add_facet_field "
|
123
|
-
config.add_facet_field "
|
124
|
-
config.add_facet_field "file_format_facet", :label => "File Format", :limit => 5
|
92
|
+
config.add_facet_field solr_name("desc_metadata__resource_type", :facetable), :label => "Resource Type", :limit => 5
|
93
|
+
config.add_facet_field solr_name("desc_metadata__creator", :facetable), :label => "Creator", :limit => 5
|
94
|
+
config.add_facet_field solr_name("desc_metadata__tag", :facetable), :label => "Keyword", :limit => 5
|
95
|
+
config.add_facet_field solr_name("desc_metadata__subject", :facetable), :label => "Subject", :limit => 5
|
96
|
+
config.add_facet_field solr_name("desc_metadata__language", :facetable), :label => "Language", :limit => 5
|
97
|
+
config.add_facet_field solr_name("desc_metadata__based_near", :facetable), :label => "Location", :limit => 5
|
98
|
+
config.add_facet_field solr_name("desc_metadata__publisher", :facetable), :label => "Publisher", :limit => 5
|
99
|
+
config.add_facet_field solr_name("file_format", :facetable), :label => "File Format", :limit => 5
|
125
100
|
|
126
101
|
# Have BL send all facet field names to Solr, which has been the default
|
127
102
|
# previously. Simply remove these lines if you'd rather use Solr request
|
@@ -130,41 +105,41 @@ class CatalogController < ApplicationController
|
|
130
105
|
|
131
106
|
# solr fields to be displayed in the index (search results) view
|
132
107
|
# The ordering of the field names is the order of the display
|
133
|
-
config.add_index_field "
|
134
|
-
config.add_index_field "
|
135
|
-
config.add_index_field "
|
136
|
-
config.add_index_field "
|
137
|
-
config.add_index_field "
|
138
|
-
config.add_index_field "
|
139
|
-
config.add_index_field "
|
140
|
-
config.add_index_field "
|
141
|
-
config.add_index_field "
|
142
|
-
config.add_index_field "
|
143
|
-
config.add_index_field "
|
144
|
-
config.add_index_field "
|
145
|
-
config.add_index_field "
|
146
|
-
config.add_index_field "
|
147
|
-
config.add_index_field "
|
148
|
-
config.add_index_field "
|
108
|
+
config.add_index_field solr_name("desc_metadata__title", :stored_searchable, type: :string), :label => "Title"
|
109
|
+
config.add_index_field solr_name("desc_metadata__description", :stored_searchable, type: :string), :label => "Description"
|
110
|
+
config.add_index_field solr_name("desc_metadata__tag", :stored_searchable, type: :string), :label => "Keyword"
|
111
|
+
config.add_index_field solr_name("desc_metadata__subject", :stored_searchable, type: :string), :label => "Subject"
|
112
|
+
config.add_index_field solr_name("desc_metadata__creator", :stored_searchable, type: :string), :label => "Creator"
|
113
|
+
config.add_index_field solr_name("desc_metadata__contributor", :stored_searchable, type: :string), :label => "Contributor"
|
114
|
+
config.add_index_field solr_name("desc_metadata__publisher", :stored_searchable, type: :string), :label => "Publisher"
|
115
|
+
config.add_index_field solr_name("desc_metadata__based_near", :stored_searchable, type: :string), :label => "Location"
|
116
|
+
config.add_index_field solr_name("desc_metadata__language", :stored_searchable, type: :string), :label => "Language"
|
117
|
+
config.add_index_field solr_name("desc_metadata__date_uploaded", :stored_searchable, type: :string), :label => "Date Uploaded"
|
118
|
+
config.add_index_field solr_name("desc_metadata__date_modified", :stored_searchable, type: :string), :label => "Date Modified"
|
119
|
+
config.add_index_field solr_name("desc_metadata__date_created", :stored_searchable, type: :string), :label => "Date Created"
|
120
|
+
config.add_index_field solr_name("desc_metadata__rights", :stored_searchable, type: :string), :label => "Rights"
|
121
|
+
config.add_index_field solr_name("desc_metadata__resource_type", :stored_searchable, type: :string), :label => "Resource Type"
|
122
|
+
config.add_index_field solr_name("desc_metadata__format", :stored_searchable, type: :string), :label => "File Format"
|
123
|
+
config.add_index_field solr_name("desc_metadata__identifier", :stored_searchable, type: :string), :label => "Identifier"
|
149
124
|
|
150
125
|
# solr fields to be displayed in the show (single result) view
|
151
126
|
# The ordering of the field names is the order of the display
|
152
|
-
config.add_show_field "
|
153
|
-
config.add_show_field "
|
154
|
-
config.add_show_field "
|
155
|
-
config.add_show_field "
|
156
|
-
config.add_show_field "
|
157
|
-
config.add_show_field "
|
158
|
-
config.add_show_field "
|
159
|
-
config.add_show_field "
|
160
|
-
config.add_show_field "
|
161
|
-
config.add_show_field "
|
162
|
-
config.add_show_field "
|
163
|
-
config.add_show_field "
|
164
|
-
config.add_show_field "
|
165
|
-
config.add_show_field "
|
166
|
-
config.add_show_field "
|
167
|
-
config.add_show_field "
|
127
|
+
config.add_show_field solr_name("desc_metadata__title", :stored_searchable, type: :string), :label => "Title"
|
128
|
+
config.add_show_field solr_name("desc_metadata__description", :stored_searchable, type: :string), :label => "Description"
|
129
|
+
config.add_show_field solr_name("desc_metadata__tag", :stored_searchable, type: :string), :label => "Keyword"
|
130
|
+
config.add_show_field solr_name("desc_metadata__subject", :stored_searchable, type: :string), :label => "Subject"
|
131
|
+
config.add_show_field solr_name("desc_metadata__creator", :stored_searchable, type: :string), :label => "Creator"
|
132
|
+
config.add_show_field solr_name("desc_metadata__contributor", :stored_searchable, type: :string), :label => "Contributor"
|
133
|
+
config.add_show_field solr_name("desc_metadata__publisher", :stored_searchable, type: :string), :label => "Publisher"
|
134
|
+
config.add_show_field solr_name("desc_metadata__based_near", :stored_searchable, type: :string), :label => "Location"
|
135
|
+
config.add_show_field solr_name("desc_metadata__language", :stored_searchable, type: :string), :label => "Language"
|
136
|
+
config.add_show_field solr_name("desc_metadata__date_uploaded", :stored_searchable, type: :string), :label => "Date Uploaded"
|
137
|
+
config.add_show_field solr_name("desc_metadata__date_modified", :stored_searchable, type: :string), :label => "Date Modified"
|
138
|
+
config.add_show_field solr_name("desc_metadata__date_created", :stored_searchable, type: :string), :label => "Date Created"
|
139
|
+
config.add_show_field solr_name("desc_metadata__rights", :stored_searchable, type: :string), :label => "Rights"
|
140
|
+
config.add_show_field solr_name("desc_metadata__resource_type", :stored_searchable, type: :string), :label => "Resource Type"
|
141
|
+
config.add_show_field solr_name("desc_metadata__format", :stored_searchable, type: :string), :label => "File Format"
|
142
|
+
config.add_show_field solr_name("desc_metadata__identifier", :stored_searchable, type: :string), :label => "Identifier"
|
168
143
|
|
169
144
|
# "fielded" search configuration. Used by pulldown among other places.
|
170
145
|
# For supported keys in hash, see rdoc for Blacklight::SearchFields
|
@@ -183,7 +158,15 @@ class CatalogController < ApplicationController
|
|
183
158
|
# This one uses all the defaults set by the solr request handler. Which
|
184
159
|
# solr request handler? The one set in config[:default_solr_parameters][:qt],
|
185
160
|
# since we aren't specifying it otherwise.
|
186
|
-
config.add_search_field
|
161
|
+
config.add_search_field('all_fields', :label => 'All Fields', :include_in_advanced_search => false) do |field|
|
162
|
+
title_name = solr_name("desc_metadata__title", :stored_searchable, type: :string)
|
163
|
+
label_name = solr_name("desc_metadata__title", :stored_searchable, type: :string)
|
164
|
+
contributor_name = solr_name("desc_metadata__contributor", :stored_searchable, type: :string)
|
165
|
+
field.solr_parameters = {
|
166
|
+
:qf => "#{title_name} noid_tsi #{label_name} file_format_tesim #{contributor_name}",
|
167
|
+
:pf => "#{title_name}"
|
168
|
+
}
|
169
|
+
end
|
187
170
|
|
188
171
|
|
189
172
|
# Now we see how to over-ride Solr request handler defaults, in this
|
@@ -199,17 +182,21 @@ class CatalogController < ApplicationController
|
|
199
182
|
# syntax, as eg {! qf=$title_qf }. This is neccesary to use
|
200
183
|
# Solr parameter de-referencing like $title_qf.
|
201
184
|
# See: http://wiki.apache.org/solr/LocalParams
|
185
|
+
solr_name = solr_name("desc_metadata__contributor", :stored_searchable, type: :string)
|
202
186
|
field.solr_local_parameters = {
|
203
|
-
:qf =>
|
204
|
-
:pf =>
|
187
|
+
:qf => solr_name,
|
188
|
+
:pf => solr_name
|
205
189
|
}
|
206
190
|
end
|
207
191
|
|
192
|
+
|
193
|
+
|
208
194
|
config.add_search_field('creator') do |field|
|
209
195
|
field.solr_parameters = { :"spellcheck.dictionary" => "creator" }
|
196
|
+
solr_name = solr_name("desc_metadata__creator", :stored_searchable, type: :string)
|
210
197
|
field.solr_local_parameters = {
|
211
|
-
:qf =>
|
212
|
-
:pf =>
|
198
|
+
:qf => solr_name,
|
199
|
+
:pf => solr_name
|
213
200
|
}
|
214
201
|
end
|
215
202
|
|
@@ -217,9 +204,10 @@ class CatalogController < ApplicationController
|
|
217
204
|
field.solr_parameters = {
|
218
205
|
:"spellcheck.dictionary" => "title"
|
219
206
|
}
|
207
|
+
solr_name = solr_name("desc_metadata__title", :stored_searchable, type: :string)
|
220
208
|
field.solr_local_parameters = {
|
221
|
-
:qf =>
|
222
|
-
:pf =>
|
209
|
+
:qf => solr_name,
|
210
|
+
:pf => solr_name
|
223
211
|
}
|
224
212
|
end
|
225
213
|
|
@@ -228,9 +216,10 @@ class CatalogController < ApplicationController
|
|
228
216
|
field.solr_parameters = {
|
229
217
|
:"spellcheck.dictionary" => "description"
|
230
218
|
}
|
219
|
+
solr_name = solr_name("desc_metadata__description", :stored_searchable, type: :string)
|
231
220
|
field.solr_local_parameters = {
|
232
|
-
:qf =>
|
233
|
-
:pf =>
|
221
|
+
:qf => solr_name,
|
222
|
+
:pf => solr_name
|
234
223
|
}
|
235
224
|
end
|
236
225
|
|
@@ -238,9 +227,10 @@ class CatalogController < ApplicationController
|
|
238
227
|
field.solr_parameters = {
|
239
228
|
:"spellcheck.dictionary" => "publisher"
|
240
229
|
}
|
230
|
+
solr_name = solr_name("desc_metadata__publisher", :stored_searchable, type: :string)
|
241
231
|
field.solr_local_parameters = {
|
242
|
-
:qf =>
|
243
|
-
:pf =>
|
232
|
+
:qf => solr_name,
|
233
|
+
:pf => solr_name
|
244
234
|
}
|
245
235
|
end
|
246
236
|
|
@@ -248,9 +238,10 @@ class CatalogController < ApplicationController
|
|
248
238
|
field.solr_parameters = {
|
249
239
|
:"spellcheck.dictionary" => "date_created"
|
250
240
|
}
|
241
|
+
solr_name = solr_name("desc_metadata__created", :stored_searchable, type: :string)
|
251
242
|
field.solr_local_parameters = {
|
252
|
-
:qf =>
|
253
|
-
:pf =>
|
243
|
+
:qf => solr_name,
|
244
|
+
:pf => solr_name
|
254
245
|
}
|
255
246
|
end
|
256
247
|
|
@@ -258,9 +249,10 @@ class CatalogController < ApplicationController
|
|
258
249
|
field.solr_parameters = {
|
259
250
|
:"spellcheck.dictionary" => "subject"
|
260
251
|
}
|
252
|
+
solr_name = solr_name("desc_metadata__subject", :stored_searchable, type: :string)
|
261
253
|
field.solr_local_parameters = {
|
262
|
-
:qf =>
|
263
|
-
:pf =>
|
254
|
+
:qf => solr_name,
|
255
|
+
:pf => solr_name
|
264
256
|
}
|
265
257
|
end
|
266
258
|
|
@@ -268,9 +260,10 @@ class CatalogController < ApplicationController
|
|
268
260
|
field.solr_parameters = {
|
269
261
|
:"spellcheck.dictionary" => "language"
|
270
262
|
}
|
263
|
+
solr_name = solr_name("desc_metadata__language", :stored_searchable, type: :string)
|
271
264
|
field.solr_local_parameters = {
|
272
|
-
:qf =>
|
273
|
-
:pf =>
|
265
|
+
:qf => solr_name,
|
266
|
+
:pf => solr_name
|
274
267
|
}
|
275
268
|
end
|
276
269
|
|
@@ -278,9 +271,10 @@ class CatalogController < ApplicationController
|
|
278
271
|
field.solr_parameters = {
|
279
272
|
:"spellcheck.dictionary" => "resource_type"
|
280
273
|
}
|
274
|
+
solr_name = solr_name("desc_metadata__resource_type", :stored_searchable, type: :string)
|
281
275
|
field.solr_local_parameters = {
|
282
|
-
:qf =>
|
283
|
-
:pf =>
|
276
|
+
:qf => solr_name,
|
277
|
+
:pf => solr_name
|
284
278
|
}
|
285
279
|
end
|
286
280
|
|
@@ -289,9 +283,10 @@ class CatalogController < ApplicationController
|
|
289
283
|
field.solr_parameters = {
|
290
284
|
:"spellcheck.dictionary" => "format"
|
291
285
|
}
|
286
|
+
solr_name = solr_name("desc_metadata__format", :stored_searchable, type: :string)
|
292
287
|
field.solr_local_parameters = {
|
293
|
-
:qf =>
|
294
|
-
:pf =>
|
288
|
+
:qf => solr_name,
|
289
|
+
:pf => solr_name
|
295
290
|
}
|
296
291
|
end
|
297
292
|
|
@@ -300,9 +295,10 @@ class CatalogController < ApplicationController
|
|
300
295
|
field.solr_parameters = {
|
301
296
|
:"spellcheck.dictionary" => "identifier"
|
302
297
|
}
|
298
|
+
solr_name = solr_name("desc_metadata__id", :stored_searchable, type: :string)
|
303
299
|
field.solr_local_parameters = {
|
304
|
-
:qf =>
|
305
|
-
:pf =>
|
300
|
+
:qf => solr_name,
|
301
|
+
:pf => solr_name
|
306
302
|
}
|
307
303
|
end
|
308
304
|
|
@@ -311,9 +307,10 @@ class CatalogController < ApplicationController
|
|
311
307
|
field.solr_parameters = {
|
312
308
|
:"spellcheck.dictionary" => "based_near"
|
313
309
|
}
|
310
|
+
solr_name = solr_name("desc_metadata__based_near", :stored_searchable, type: :string)
|
314
311
|
field.solr_local_parameters = {
|
315
|
-
:qf =>
|
316
|
-
:pf =>
|
312
|
+
:qf => solr_name,
|
313
|
+
:pf => solr_name
|
317
314
|
}
|
318
315
|
end
|
319
316
|
|
@@ -321,39 +318,68 @@ class CatalogController < ApplicationController
|
|
321
318
|
field.solr_parameters = {
|
322
319
|
:"spellcheck.dictionary" => "tag"
|
323
320
|
}
|
321
|
+
solr_name = solr_name("desc_metadata__tag", :stored_searchable, type: :string)
|
324
322
|
field.solr_local_parameters = {
|
325
|
-
:qf =>
|
326
|
-
:pf =>
|
323
|
+
:qf => solr_name,
|
324
|
+
:pf => solr_name
|
327
325
|
}
|
328
326
|
end
|
329
327
|
|
330
328
|
config.add_search_field('depositor') do |field|
|
329
|
+
solr_name = solr_name("desc_metadata__depositor", :stored_searchable, type: :string)
|
331
330
|
field.solr_local_parameters = {
|
332
|
-
:qf =>
|
333
|
-
:pf =>
|
331
|
+
:qf => solr_name,
|
332
|
+
:pf => solr_name
|
334
333
|
}
|
335
334
|
end
|
336
335
|
|
337
336
|
config.add_search_field('rights') do |field|
|
337
|
+
solr_name = solr_name("desc_metadata__rights", :stored_searchable, type: :string)
|
338
338
|
field.solr_local_parameters = {
|
339
|
-
:qf =>
|
340
|
-
:pf =>
|
339
|
+
:qf => solr_name,
|
340
|
+
:pf => solr_name
|
341
341
|
}
|
342
342
|
end
|
343
343
|
|
344
|
+
|
344
345
|
# "sort results by" select (pulldown)
|
345
346
|
# label in pulldown is followed by the name of the SOLR field to sort by and
|
346
347
|
# whether the sort is ascending or descending (it must be asc or desc
|
347
348
|
# except in the relevancy case).
|
348
349
|
# label is key, solr field is value
|
349
|
-
config.add_sort_field
|
350
|
-
config.add_sort_field
|
351
|
-
config.add_sort_field
|
352
|
-
config.add_sort_field
|
353
|
-
config.add_sort_field
|
350
|
+
config.add_sort_field "score desc, #{uploaded_field} desc", :label => "relevance \u25BC"
|
351
|
+
config.add_sort_field "#{uploaded_field} desc", :label => "date uploaded \u25BC"
|
352
|
+
config.add_sort_field "#{uploaded_field} asc", :label => "date uploaded \u25B2"
|
353
|
+
config.add_sort_field "#{modified_field} desc", :label => "date modified \u25BC"
|
354
|
+
config.add_sort_field "#{modified_field} asc", :label => "date modified \u25B2"
|
354
355
|
|
355
356
|
# If there are more than this many search results, no spelling ("did you
|
356
357
|
# mean") suggestion is offered.
|
357
358
|
config.spell_max = 5
|
358
359
|
end
|
360
|
+
|
361
|
+
protected
|
362
|
+
|
363
|
+
# Limits search results just to GenericFiles
|
364
|
+
# @param solr_parameters the current solr parameters
|
365
|
+
# @param user_parameters the current user-subitted parameters
|
366
|
+
def exclude_unwanted_models(solr_parameters, user_parameters)
|
367
|
+
solr_parameters[:fq] ||= []
|
368
|
+
solr_parameters[:fq] << "#{Solrizer.solr_name("has_model", :symbol)}:\"info:fedora/afmodel:GenericFile\""
|
369
|
+
end
|
370
|
+
|
371
|
+
def depositor
|
372
|
+
#Hydra.config[:permissions][:owner] maybe it should match this config variable, but it doesn't.
|
373
|
+
Solrizer.solr_name('depositor', :stored_searchable, type: :string)
|
374
|
+
end
|
375
|
+
|
376
|
+
def filter_not_mine
|
377
|
+
"{!lucene q.op=AND df=#{depositor}}-#{current_user.user_key}"
|
378
|
+
end
|
379
|
+
|
380
|
+
def sort_field
|
381
|
+
"#{Solrizer.solr_name('system_create', :sortable)} desc"
|
382
|
+
end
|
383
|
+
|
384
|
+
|
359
385
|
end
|