From 8b71d53b7c58fbc85ced19fa654e47d4983cb7c3 Mon Sep 17 00:00:00 2001 From: RDBloese <38698852+RDBloese@users.noreply.github.com> Date: Wed, 5 Jul 2023 10:58:56 +0200 Subject: [PATCH] Update EntityController.java Fix page size --- src/main/java/tla/backend/api/EntityController.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/tla/backend/api/EntityController.java b/src/main/java/tla/backend/api/EntityController.java index ce33743b..e212e60a 100644 --- a/src/main/java/tla/backend/api/EntityController.java +++ b/src/main/java/tla/backend/api/EntityController.java @@ -2,6 +2,7 @@ import java.util.List; +import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; import org.springframework.http.HttpStatus; @@ -106,9 +107,10 @@ public ResponseEntity count() { produces = MediaType.APPLICATION_JSON_VALUE ) public ResponseEntity> search(@RequestBody SearchCommand command, Pageable page) { - log.info("page: {}", tla.domain.util.IO.json(page)); + Pageable page10 = PageRequest.of(page.getPageNumber(), 10); //sets page size to 10 + log.info("page: {}", tla.domain.util.IO.json(page10)); log.info("command: {}", tla.domain.util.IO.json(command)); - var result = this.getService().runSearchCommand(command, page); + var result = this.getService().runSearchCommand(command, page10); return new ResponseEntity>( result.orElseThrow( () -> new ObjectNotFoundException(getService().getModelClass().getName()) @@ -117,4 +119,4 @@ public ResponseEntity> search(@RequestBody SearchCommand ); } -} \ No newline at end of file +}