From f172494a02afeb4928271be87bf7bbff147e1774 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Wed, 23 Oct 2019 09:28:07 +0300 Subject: [PATCH] include repository with doi --- app/controllers/dois_controller.rb | 4 ++-- app/models/concerns/indexable.rb | 4 ++-- app/serializers/doi_serializer.rb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/dois_controller.rb b/app/controllers/dois_controller.rb index c12eb9762..f7e070a0f 100644 --- a/app/controllers/dois_controller.rb +++ b/app/controllers/dois_controller.rb @@ -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 diff --git a/app/models/concerns/indexable.rb b/app/models/concerns/indexable.rb index 39f44cd18..d81873751 100644 --- a/app/models/concerns/indexable.rb +++ b/app/models/concerns/indexable.rb @@ -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] @@ -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] diff --git a/app/serializers/doi_serializer.rb b/app/serializers/doi_serializer.rb index 908494d42..6182cd0c6 100644 --- a/app/serializers/doi_serializer.rb +++ b/app/serializers/doi_serializer.rb @@ -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|