-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
186 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
module CurationConcerns::SearchPathsHelper | ||
def search_path_for_my_works(opts = {}) | ||
params_for_my_works = { 'f[generic_type_sim][]' => 'Work', works: 'mine' } | ||
main_app.catalog_index_path(params_for_my_works.merge(opts)) | ||
main_app.search_catalog_path(params_for_my_works.merge(opts)) | ||
end | ||
|
||
def search_path_for_my_collections(opts = {}) | ||
params_for_my_collections = { 'f[generic_type_sim][]' => 'Collection', works: 'mine' } | ||
main_app.catalog_index_path(params_for_my_collections.merge(opts)) | ||
main_app.search_catalog_path(params_for_my_collections.merge(opts)) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
app/search_builders/curation_concerns/collection_member_search_builder.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module CurationConcerns | ||
class CollectionMemberSearchBuilder < Hydra::Collections::MemberSearchBuilder | ||
include CurationConcerns::FilterByType | ||
end | ||
end |
10 changes: 10 additions & 0 deletions
10
app/search_builders/curation_concerns/file_set_search_builder.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module CurationConcerns | ||
class FileSetSearchBuilder < Hydra::SearchBuilder | ||
include CurationConcerns::SingleResult | ||
self.default_processor_chain += [:only_file_sets] | ||
|
||
def only_file_sets(solr_parameters) | ||
solr_parameters[:fq] << ActiveFedora::SolrQueryBuilder.construct_query_for_rel(has_model: ::FileSet.to_class_uri) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module CurationConcerns | ||
module FilterByType | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
self.default_processor_chain += [:filter_models] | ||
end | ||
|
||
# Add queries that excludes everything except for works and collections | ||
def filter_models(solr_parameters) | ||
solr_parameters[:fq] ||= [] | ||
solr_parameters[:fq] << '(' + (work_clauses + collection_clauses).join(' OR ') + ')' | ||
end | ||
|
||
private | ||
|
||
def work_clauses | ||
return [] if blacklight_params.key?(:f) && Array(blacklight_params[:f][:generic_type_sim]).include?('Collection') | ||
CurationConcerns.config.registered_curation_concern_types.map(&:constantize).map do |klass| | ||
ActiveFedora::SolrQueryBuilder.construct_query_for_rel(has_model: klass.to_class_uri) | ||
end | ||
end | ||
|
||
def collection_clauses | ||
return [] if blacklight_params.key?(:f) && Array(blacklight_params[:f][:generic_type_sim]).include?('Work') | ||
[ActiveFedora::SolrQueryBuilder.construct_query_for_rel(has_model: ::Collection.to_class_uri)] | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module CurationConcerns | ||
module SingleResult | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
self.default_processor_chain += [:find_one] | ||
end | ||
|
||
def find_one(solr_parameters) | ||
solr_parameters[:fq] << "_query_:\"{!raw f=id}#{blacklight_params.fetch(:id)}\"" | ||
end | ||
end | ||
end |
6 changes: 6 additions & 0 deletions
6
app/search_builders/curation_concerns/single_use_link_search_builder.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module CurationConcerns | ||
class SingleUseLinkSearchBuilder < CurationConcerns::SearchBuilder | ||
include CurationConcerns::SingleResult | ||
self.default_processor_chain = [:find_one] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module CurationConcerns | ||
class WorkSearchBuilder < CurationConcerns::SearchBuilder | ||
include CurationConcerns::SingleResult | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Overriding Blacklight so that the search results can be displayed in a way compatible with | ||
# tokenInput javascript library. This is used for suggesting "Related Works" to attach. | ||
|
||
json.docs @presenter.documents do |solr_document| | ||
title = solr_document['title_tesim'].first | ||
title << " (#{solr_document['human_readable_type_tesim'].first})" if solr_document['human_readable_type_tesim'].present? | ||
json.pid solr_document['id'] | ||
json.title title | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.