Skip to content

Commit

Permalink
Merge pull request #6623 from IQSS/6601-file-count
Browse files Browse the repository at this point in the history
in Search API show fileCount for datasets #6601
  • Loading branch information
kcondon authored Feb 19, 2020
2 parents 18e2813 + 055fa5f commit 638ca77
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions doc/sphinx-guides/source/api/search.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ https://demo.dataverse.org/api/search?q=trees
"Astronomy and Astrophysics",
"Other"
],
"fileCount":3,
"versionId":1260,
"versionState":"RELEASED",
"majorVersion":3,
Expand Down Expand Up @@ -291,6 +292,7 @@ The above example ``fq=publicationStatus:Published`` retrieves only "RELEASED" v
"subjects": [
"Medicine, Health and Life Sciences"
],
"fileCount":6,
"versionId": 53001,
"versionState": "RELEASED",
"majorVersion": 1,
Expand Down Expand Up @@ -323,6 +325,7 @@ The above example ``fq=publicationStatus:Published`` retrieves only "RELEASED" v
"subjects": [
"Medicine, Health and Life Sciences"
],
"fileCount":9,
"versionId": 53444,
"versionState": "RELEASED",
"majorVersion": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ public JsonObjectBuilder json(boolean showRelevance, boolean showEntityIds, bool
subjects.add(subject);
}
nullSafeJsonBuilder.add("subjects", subjects);
nullSafeJsonBuilder.add("fileCount", dv.getFileMetadatas().size());
nullSafeJsonBuilder.add("versionId", dv.getId());
nullSafeJsonBuilder.add("versionState", dv.getVersionState().toString());
if(this.isPublishedState()){
Expand Down
1 change: 1 addition & 0 deletions src/test/java/edu/harvard/iq/dataverse/api/SearchIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ public void testDatasetThumbnail() {
search2.prettyPrint();
search2.then().assertThat()
.body("data.items[0].name", CoreMatchers.equalTo("Darwin's Finches"))
.body("data.items[0].fileCount", CoreMatchers.equalTo(1))
.statusCode(200);

//Unpublished datafiles no longer populate the dataset thumbnail
Expand Down

0 comments on commit 638ca77

Please sign in to comment.