Skip to content

Commit

Permalink
rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
sondrev committed Oct 11, 2024
1 parent 1da4bae commit a2cdf0e
Show file tree
Hide file tree
Showing 5 changed files with 1,374 additions and 233 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
*/
@SuppressWarnings("PMD.GodClass")
public final class ResourceSearchQuery extends SearchQuery<ResourceParameter> {

private static final String EXCLUDED_RESOURCE_FIELDS = "entityDescription.contributors";
private final ResourceStreamBuilders streamBuilders;
private final ResourceAccessFilter filterBuilder;
private final Map<String, String> additionalQueryParameters = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class Containers {
public static IndexingClient indexingClient;

public static void setup() throws IOException, InterruptedException {
container.start();
container.withEnv("indices.query.bool.max_clause_count", "2048").start();

var restClientBuilder = RestClient.builder(HttpHost.create(container.getHttpHostAddress()));
var restHighLevelClientWrapper = new RestHighLevelClientWrapper(restClientBuilder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,28 @@ void shouldReturnResourcesWithSubunitsWhenExcludedSubunitsNotProvided()
assertThat(pagedSearchResourceDto.hits(), hasSize(2));
}

@Test
void shouldReturnResourcesWithFieldContributorsPreviewAndNotPreview()
throws BadRequestException {

var response =
ResourceSearchQuery.builder()
.withRequiredParameters(FROM, SIZE, AGGREGATION)
.withDockerHostUri(URI.create(container.getHttpHostAddress()))
.withAlwaysExcludedFields("entityDescription.contributors")
.build()
.withFilter()
.requiredStatus(PUBLISHED, PUBLISHED_METADATA, DELETED)
.apply()
.doSearch(searchClient);

var pagedSearchResourceDto = response.toPagedResponse();

assertThat(
pagedSearchResourceDto.toJsonString(), containsString("\"contributorsPreview\":"));
assertThat(pagedSearchResourceDto.toJsonString(), not(containsString("\"contributors\":")));
}

@ParameterizedTest
@MethodSource("provideValidPageRanges")
void shouldFilterByPageCount(int min, int max, int expectedResultCount)
Expand Down
Loading

0 comments on commit a2cdf0e

Please sign in to comment.