Skip to content

Commit

Permalink
Fix UserSelectionsApiTest being too strict about the submittor
Browse files Browse the repository at this point in the history
  • Loading branch information
tobias-hotz committed Nov 7, 2024
1 parent 66e9c38 commit ddb7766
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions index/src/main/java/org/fao/geonet/index/es/EsRestClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -336,23 +336,21 @@ public SearchResponse query(String index, Query.Builder queryBuilder, Query.Buil
}


public String deleteByQuery(String index, String query) throws Exception {
public void deleteByQuery(String index, String query) throws Exception {
if (!activated) {
return "";
throw new IllegalStateException("Index not yet activated.");
}

DeleteByQueryRequest request = DeleteByQueryRequest.of(
b -> b.index(new ArrayList<>(Arrays.asList(index)))
b -> b.index(index)
.q(query)
.refresh(true));

final DeleteByQueryResponse deleteByQueryResponse =
client.deleteByQuery(request);


if (deleteByQueryResponse.deleted() >= 0) {
return String.format("Record removed. %s.", deleteByQueryResponse.deleted());
} else {
if (!deleteByQueryResponse.failures().isEmpty()) {
StringBuilder stringBuilder = new StringBuilder();

deleteByQueryResponse.failures().forEach(f -> stringBuilder.append(f.toString()));
Expand Down

0 comments on commit ddb7766

Please sign in to comment.