Skip to content

Commit

Permalink
Set default value for 'antall' in OpenSearchService to improve search…
Browse files Browse the repository at this point in the history
… functionality #deploy-dolly-search-service
  • Loading branch information
krharum committed Feb 21, 2025
1 parent 6325ee1 commit ff1bed4
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import java.util.concurrent.TimeUnit;

import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
import static org.apache.commons.lang3.StringUtils.isNotBlank;

@Slf4j
Expand All @@ -40,15 +39,19 @@ private Mono<SearchResponse> execQuery(SearchRequest request, BoolQueryBuilder q
request.setSide(1);
}

if (isNull(request.getAntall())) {
request.setAntall(10);
}

return Mono.from(openSearchConsumer.search(
no.nav.testnav.dollysearchservice.dto.SearchRequest.builder()
.query(
new org.opensearch.action.search.SearchRequest()
.indices("pdl-sok")
.source(new SearchSourceBuilder()
.query(query)
.from(request.getSide())
.size(nonNull(request.getAntall()) ? request.getAntall() : 10)
.from(request.getSide() * request.getAntall())
.size(request.getAntall())
.timeout(new TimeValue(3, TimeUnit.SECONDS))))
.request(request)
.build()))
Expand Down

0 comments on commit ff1bed4

Please sign in to comment.