FullTextQuery.iterate() skips last result.

Description

line 152 : int size = max - first + 1 < 0 ? 0 : max - first + 1;

will produce wrong size, because max( first, queryHits.totalHits ) returns not the size of the selection but the max element index so for 3 hits max=2.
And since first element is 1 and not 0 we have to account for it.

Correct size calculation:
line 152 : int size = max - first + 2 < 0 ? 0 : max - first + 2;

Environment

None

Status

Assignee

Sanne Grinovero

Reporter

Ivan Latysh

Labels

None

Suitable for new contributors

None

Pull Request

None

Feedback Requested

None

Components

Fix versions

Affects versions

3.1.0.GA

Priority

Blocker