-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Review changes, Opensearch refactors and fixes #267
- Loading branch information
1 parent
60f30a6
commit de47467
Showing
13 changed files
with
1,384 additions
and
1,197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1,326 changes: 433 additions & 893 deletions
1,326
src/main/java/org/icatproject/core/manager/search/OpensearchApi.java
Large diffs are not rendered by default.
Oops, something went wrong.
57 changes: 57 additions & 0 deletions
57
src/main/java/org/icatproject/core/manager/search/OpensearchBulk.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package org.icatproject.core.manager.search; | ||
|
||
import java.util.HashMap; | ||
import java.util.HashSet; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
/** | ||
* Holds information for the various types of request that need to be made as | ||
* part of a bulk modification. | ||
*/ | ||
public class OpensearchBulk { | ||
|
||
public Map<String, Set<String>> updatesMap = new HashMap<>(); | ||
public Set<String> investigationIds = new HashSet<>(); | ||
public Map<String, long[]> investigationAggregations = new HashMap<>(); | ||
public Map<String, long[]> datasetAggregations = new HashMap<>(); | ||
public StringBuilder bulkBuilder = new StringBuilder(); | ||
public StringBuilder deletionBuilder = new StringBuilder(); | ||
public StringBuilder fileAggregationBuilder = new StringBuilder(); | ||
|
||
/** | ||
* Adds a path and body for a single update to updatesMap, if not already | ||
* present. | ||
* | ||
* @param path Path of request | ||
* @param body Body of request | ||
*/ | ||
public void addUpdate(String path, String body) { | ||
Set<String> bodies = updatesMap.getOrDefault(path, new HashSet<>()); | ||
bodies.add(body); | ||
updatesMap.put(path, bodies); | ||
} | ||
|
||
/** | ||
* @return String of updates that should be performed as a bulk request | ||
*/ | ||
public String bulkBody() { | ||
return bulkBuilder.toString(); | ||
} | ||
|
||
/** | ||
* @return String of deletes that should be performed as a bulk request | ||
*/ | ||
public String deletedBody() { | ||
return deletionBuilder.toString(); | ||
} | ||
|
||
/** | ||
* @return String of file aggregations that should be performed as a bulk | ||
* request | ||
*/ | ||
public String fileAggregationBody() { | ||
return fileAggregationBuilder.toString(); | ||
} | ||
|
||
} |
Oops, something went wrong.