Skip to content

Commit

Permalink
Appease rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
jrhoads committed Dec 12, 2024
1 parent eafbeae commit 39d6ece
Show file tree
Hide file tree
Showing 4 changed files with 202 additions and 213 deletions.
2 changes: 1 addition & 1 deletion app/models/doi/graphql_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def size
end

def sort
DEFAULT_SORT
DEFAULT_SORT
end

def query_fields
Expand Down
223 changes: 110 additions & 113 deletions spec/models/doi/graphql_query_builder_aggregates_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,110 +11,110 @@
builder = described_class.new(query, options)
expect(builder.aggregations).to eq(
{
:affiliations=>{:terms=>{:field=>"affiliation_id_and_name", :min_doc_count=>1, :missing=>"__missing__", :size=>10}},
:authors=>{
:aggs=>{:authors=>{
:top_hits=>{:_source=>{
:includes=>["creators.name", "creators.nameIdentifiers.nameIdentifier"],
}, :size=>1},
}},
:terms=>{:field=>"creators.nameIdentifiers.nameIdentifier", :include=>"https?://orcid.org/.*", :min_doc_count=>1, :size=>10},
},
:citation_count=>{
:sum=>{:field=>"citation_count"},
},
:client_types=>{
:terms=>{:field=>"client.client_type", :min_doc_count=>1, :size=>10},
},
:clients=>{
:terms=>{:field=>"client_id_and_name", :min_doc_count=>1, :size=>10},
},
:content_url_count=>{
:value_count=>{:field=>"content_url"},
},
:creators_and_contributors=>{
:aggs=>{
:creators_and_contributors=>{
:top_hits=>{:_source=>{
:includes=>["creators_and_contributors.name", "creators_and_contributors.nameIdentifiers.nameIdentifier"],
}, :size=>1},
affiliations: { terms: { field: "affiliation_id_and_name", min_doc_count: 1, missing: "__missing__", size: 10 } },
authors: {
aggs: { authors: {
top_hits: { _source: {
includes: ["creators.name", "creators.nameIdentifiers.nameIdentifier"],
}, size: 1 },
} },
terms: { field: "creators.nameIdentifiers.nameIdentifier", include: "https?://orcid.org/.*", min_doc_count: 1, size: 10 },
},
citation_count: {
sum: { field: "citation_count" },
},
client_types: {
terms: { field: "client.client_type", min_doc_count: 1, size: 10 },
},
clients: {
terms: { field: "client_id_and_name", min_doc_count: 1, size: 10 },
},
content_url_count: {
value_count: { field: "content_url" },
},
creators_and_contributors: {
aggs: {
creators_and_contributors: {
top_hits: { _source: {
includes: ["creators_and_contributors.name", "creators_and_contributors.nameIdentifiers.nameIdentifier"],
}, size: 1 },
},
:work_types=>{:terms=>{:field=>"resource_type_id_and_name", :min_doc_count=>1}},
work_types: { terms: { field: "resource_type_id_and_name", min_doc_count: 1 } },
},
:terms=>{
:field=>"creators_and_contributors.nameIdentifiers.nameIdentifier",
:include=>"https?://orcid.org/.*",
:min_doc_count=>1,
:size=>10,
terms: {
field: "creators_and_contributors.nameIdentifiers.nameIdentifier",
include: "https?://orcid.org/.*",
min_doc_count: 1,
size: 10,
},
},
:download_count=>{
:sum=>{:field=>"download_count"},
},
:fields_of_science=>{
:aggs=>{
:subject=>{
:terms=>{
:field=>"subjects.subject",
:include=>"FOS:.*",
:min_doc_count=>1,
:size=>10,
download_count: {
sum: { field: "download_count" },
},
fields_of_science: {
aggs: {
subject: {
terms: {
field: "subjects.subject",
include: "FOS:.*",
min_doc_count: 1,
size: 10,
},
},
},
:filter=>{
:term=>{:"subjects.subjectScheme"=>"Fields of Science and Technology (FOS)"},
filter: {
term: { "subjects.subjectScheme": "Fields of Science and Technology (FOS)" },
},
},
:fields_of_science_combined=>{
:terms=>{
:field=>"fields_of_science_combined",
:min_doc_count=>1,
:size=>10,
fields_of_science_combined: {
terms: {
field: "fields_of_science_combined",
min_doc_count: 1,
size: 10,
},
},
:fields_of_science_repository=>{
:terms=>{
:field=>"fields_of_science_repository",
:min_doc_count=>1,
:size=>10,
fields_of_science_repository: {
terms: {
field: "fields_of_science_repository",
min_doc_count: 1,
size: 10,
},
},
:funders=>{
:aggs=>{:funders=>{:top_hits=>{:_source=>{:includes=>["funding_references.funderName", "funding_references.funderIdentifier"]}, :size=>1}}},
:terms=>{
:field=>"funding_references.funderIdentifier",
:min_doc_count=>1,
:size=>10,
funders: {
aggs: { funders: { top_hits: { _source: { includes: ["funding_references.funderName", "funding_references.funderIdentifier"] }, size: 1 } } },
terms: {
field: "funding_references.funderIdentifier",
min_doc_count: 1,
size: 10,
},
},
:languages=>{
:terms=>{
:field=>"language",
:min_doc_count=>1,
:size=>10,
languages: {
terms: {
field: "language",
min_doc_count: 1,
size: 10,
},
},
:licenses=>{
:terms=>{
:field=>"rights_list.rightsIdentifier",
:min_doc_count=>1,
:missing=>"__missing__",
:size=>10,
licenses: {
terms: {
field: "rights_list.rightsIdentifier",
min_doc_count: 1,
missing: "__missing__",
size: 10,
},
},
:open_licenses=>{
:aggs=>{
:resource_types=>{
:terms=>{
:field=>"resource_type_id_and_name",
:min_doc_count=>1,
:size=>10,
open_licenses: {
aggs: {
resource_types: {
terms: {
field: "resource_type_id_and_name",
min_doc_count: 1,
size: 10,
},
},
},
:filter=>{
:terms=>{:"rights_list.rightsIdentifier"=>[
filter: {
terms: { "rights_list.rightsIdentifier": [
"cc-by-1.0",
"cc-by-2.0",
"cc-by-2.5",
Expand All @@ -125,15 +125,15 @@
"cc-pddc",
"cc0-1.0",
"cc-pdm-1.0",
]},
] },
},
},
:pid_entities=>{
:aggs=>{
:subject=>{
:terms=>{
:field=>"subjects.subject",
:include=>[
pid_entities: {
aggs: {
subject: {
terms: {
field: "subjects.subject",
include: [
"Dataset",
"Publication",
"Software",
Expand All @@ -146,33 +146,33 @@
"Repository",
"Project",
],
:min_doc_count=>1,
:size=>10,
min_doc_count: 1,
size: 10,
},
},
},
:filter=>{:term=>{:"subjects.subjectScheme"=>"PidEntity"}},
},
:published=>{
:date_histogram=>{
:field=>"publication_year",
:format=>"year",
:interval=>"year",
:min_doc_count=>1,
:order=>{:_key=>"desc"},
filter: { term: { "subjects.subjectScheme": "PidEntity" } },
},
published: {
date_histogram: {
field: "publication_year",
format: "year",
interval: "year",
min_doc_count: 1,
order: { _key: "desc" },
},
},
:registration_agencies=>{
:terms=>{:field=>"agency", :min_doc_count=>1, :size=>10},
registration_agencies: {
terms: { field: "agency", min_doc_count: 1, size: 10 },
},
:resource_types=>{:terms=>{
:field=>"resource_type_id_and_name",
:min_doc_count=>1,
:missing=>"__missing__",
:size=>10,
}},
:view_count=>{
:sum=>{:field=>"view_count"},
resource_types: { terms: {
field: "resource_type_id_and_name",
min_doc_count: 1,
missing: "__missing__",
size: 10,
} },
view_count: {
sum: { field: "view_count" },
},
}
)
Expand Down Expand Up @@ -206,7 +206,4 @@
expect(builder.aggregations.keys).to match_array(expected_keys)
end
end



end
Loading

0 comments on commit 39d6ece

Please sign in to comment.