Skip to content

Commit

Permalink
Merge pull request #563 from NDLANO/calculate-size
Browse files Browse the repository at this point in the history
calculate correct resultwindow
  • Loading branch information
gunnarvelle authored Dec 13, 2024
2 parents 3502cf9 + 63f17fc commit ecae7b7
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ trait SearchService {
val safePageSize = max(pageSize.min(MaxPageSize), 0)
val safePage = page.max(1)
val startAt = (safePage - 1) * safePageSize
val resultWindow = (startAt + 1) * safePageSize
val resultWindow = startAt + safePageSize
if (resultWindow > maxResultWindow) {
logger.info(s"Max supported results are $maxResultWindow, user requested $resultWindow")
Failure(ResultWindowTooLargeException())
Expand Down

0 comments on commit ecae7b7

Please sign in to comment.