Skip to content

Commit

Permalink
Merge pull request #757 from datacite/repository-facet
Browse files Browse the repository at this point in the history
Added missing aggregation in model
  • Loading branch information
kjgarza authored Sep 29, 2021
2 parents 14b6837 + d73d9dc commit 9ddba04
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/models/doi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,7 @@ def self.gql_query_aggregations(facet_count: 10)
if facet_count.positive?
{
resource_types: { terms: { field: "resource_type_id_and_name", size: facet_count, min_doc_count: 1 } },
clients: { terms: { field: "client_id_and_name", size: facet_count, min_doc_count: 1 } },
open_licenses: {
filter: { terms: { "rights_list.rightsIdentifier": ["cc-by-1.0", "cc-by-2.0", "cc-by-2.5", "cc-by-3.0", "cc-by-3.0-at", "cc-by-3.0-us", "cc-by-4.0", "cc-pddc", "cc0-1.0", "cc-pdm-1.0"] } },
aggs: {
Expand Down
8 changes: 8 additions & 0 deletions spec/graphql/types/work_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,11 @@
title
count
}
repositories {
id
title
count
}
languages {
id
title
Expand Down Expand Up @@ -646,6 +651,9 @@
expect(response.dig("data", "works", "registrationAgencies")).to eq(
[{ "count" => 10, "id" => "datacite", "title" => "DataCite" }],
)
expect(response.dig("data", "works", "repositories").first["title"]).to eq(
"My data center"
)
expect(response.dig("data", "works", "languages")).to eq(
[{ "count" => 10, "id" => "nl", "title" => "Dutch" }],
)
Expand Down

0 comments on commit 9ddba04

Please sign in to comment.