Skip to content

Commit

Permalink
Remove placeholder values for size and count #267
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-austin committed Jul 3, 2023
1 parent 906ba63 commit 8abef9a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
6 changes: 1 addition & 5 deletions src/main/java/org/icatproject/core/entity/Datafile.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,7 @@ public void getDoc(JsonGenerator gen) {
if (doi != null) {
SearchApi.encodeString(gen, "doi", doi);
}
if (fileSize != null) {
SearchApi.encodeLong(gen, "fileSize", fileSize);
} else {
SearchApi.encodeLong(gen, "fileSize", 0L);
}
SearchApi.encodeLong(gen, "fileSize", fileSize);
SearchApi.encodeLong(gen, "fileCount", 1L); // Always 1, but makes sorting on fields consistent
if (datafileFormat != null) {
datafileFormat.getDoc(gen);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/icatproject/core/entity/Dataset.java
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ public void getDoc(JsonGenerator gen) {
} else {
SearchApi.encodeLong(gen, "endDate", modTime);
}
SearchApi.encodeLong(gen, "fileSize", 0L); // This is a placeholder to allow us to dynamically build size
SearchApi.encodeLong(gen, "fileCount", 0L); // This is a placeholder to allow us to dynamically build count
SearchApi.encodeLong(gen, "fileSize", fileSize);
SearchApi.encodeLong(gen, "fileCount", fileCount);
SearchApi.encodeString(gen, "id", id);
if (investigation != null) {
SearchApi.encodeString(gen, "investigation.id", investigation.id);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/icatproject/core/entity/Investigation.java
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,8 @@ public void getDoc(JsonGenerator gen) {
} else {
SearchApi.encodeLong(gen, "endDate", modTime);
}
SearchApi.encodeLong(gen, "fileSize", 0L); // This is a placeholder to allow us to dynamically build size
SearchApi.encodeLong(gen, "fileCount", 0L); // This is a placeholder to allow us to dynamically build count
SearchApi.encodeLong(gen, "fileSize", fileSize);
SearchApi.encodeLong(gen, "fileCount", fileCount);

SearchApi.encodeString(gen, "id", id);
facility.getDoc(gen);
Expand Down

0 comments on commit 8abef9a

Please sign in to comment.