Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in Search API show fileCount for datasets #6601 #6623

Merged
merged 1 commit into from
Feb 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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