Skip to content

Commit

Permalink
Update EntityController.java
Browse files Browse the repository at this point in the history
Fix page size
  • Loading branch information
RDBloese authored Jul 5, 2023
1 parent 348d18d commit 8b71d53
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/tla/backend/api/EntityController.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -106,9 +107,10 @@ public ResponseEntity<Long> count() {
produces = MediaType.APPLICATION_JSON_VALUE
)
public ResponseEntity<SearchResultsWrapper<?>> search(@RequestBody SearchCommand<D> 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<SearchResultsWrapper<?>>(
result.orElseThrow(
() -> new ObjectNotFoundException(getService().getModelClass().getName())
Expand All @@ -117,4 +119,4 @@ public ResponseEntity<SearchResultsWrapper<?>> search(@RequestBody SearchCommand
);
}

}
}

0 comments on commit 8b71d53

Please sign in to comment.