Skip to content

Commit

Permalink
include repository with doi
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Oct 23, 2019
1 parent 98a1f64 commit f172494
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/controllers/dois_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,9 @@ def set_doi
def set_include
if params[:include].present?
@include = params[:include].split(",").map { |i| i.downcase.underscore.to_sym }
@include = @include & [:client, :media]
@include = @include & [:repository, :media]
else
@include = [:client, :media]
@include = [:repository, :media]
end
end

Expand Down
4 changes: 2 additions & 2 deletions app/models/concerns/indexable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def query(query, options={})
must << { terms: { certificate: options[:certificate].split(",") }} if options[:certificate].present?
must << { terms: { repository_type: options[:repository_type].split(",") }} if options[:repository_type].present?
must << { term: { consortium_id: options[:consortium_id] }} if options[:consortium_id].present?
must << { term: { re3data_id: options[:re3data_id].gsub("/", '\/') }} if options[:re3data_id].present?
must << { term: { re3data_id: options[:re3data_id].gsub("/", '\/').upcase }} if options[:re3data_id].present?
must << { term: { opendoar_id: options[:opendoar_id] }} if options[:opendoar_id].present?
must << { term: { client_type: options[:client_type] }} if options[:client_type].present?
must_not << { exists: { field: "deleted_at" }} unless options[:include_deleted]
Expand All @@ -205,7 +205,7 @@ def query(query, options={})
must << { term: { "creators.nameIdentifiers.nameIdentifier" => "https://orcid.org/#{options[:user_id]}" }} if options[:user_id].present?
must << { term: { "creators.affiliation.affiliationIdentifier" => URI.decode(options[:affiliation_id]) }} if options[:affiliation_id].present?
must << { term: { consortium_id: options[:consortium_id] }} if options[:consortium_id].present?
must << { term: { "client.re3data_id" => options[:re3data_id].upcase }} if options[:re3data_id].present?
must << { term: { "client.re3data_id" => options[:re3data_id].gsub("/", '\/').upcase }} if options[:re3data_id].present?
must << { term: { "client.opendoar_id" => options[:opendoar_id] }} if options[:opendoar_id].present?
must << { terms: { "client.certificate" => options[:certificate].split(",") }} if options[:certificate].present?
must_not << { terms: { provider_id: ["crossref", "medra", "op"] }} if options[:exclude_registration_agencies]
Expand Down
2 changes: 1 addition & 1 deletion app/serializers/doi_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class DoiSerializer
attributes :doi, :prefix, :suffix, :identifiers, :creators, :titles, :publisher, :container, :publication_year, :subjects, :contributors, :dates, :language, :types, :related_identifiers, :sizes, :formats, :version, :rights_list, :descriptions, :geo_locations, :funding_references, :xml, :url, :content_url, :metadata_version, :schema_version, :source, :is_active, :state, :reason, :landing_page, :created, :registered, :published, :updated
attributes :prefix, :suffix, if: Proc.new { |object, params| params && params[:detail] }

belongs_to :client, record_type: :clients
belongs_to :repository, record_type: :repositories
has_many :media, record_type: :media, id_method_name: :uid, if: Proc.new { |object, params| params && params[:detail] && !params[:is_collection]}

attribute :xml, if: Proc.new { |object, params| params && params[:detail] } do |object|
Expand Down

0 comments on commit f172494

Please sign in to comment.