Final page of search results sometimes having erroneous "next" link
authorChad Horohoe <chadh@wikimedia.org>
Fri, 30 May 2014 22:28:13 +0000 (15:28 -0700)
committerChad Horohoe <chadh@wikimedia.org>
Fri, 30 May 2014 22:29:46 +0000 (15:29 -0700)
commitf4357b647f5e66a83552a79fbeed74927abd8e2d
tree6f2791be98d2be89866a3a708958642e7b478f9e
parentd74a185fd315a75b41c9f2a8832ac70437de0e37
Final page of search results sometimes having erroneous "next" link

Pre-patch: In the showResults method of the SpecialSearch class, a request is made
through the appropriate SearchEngine object for a single page (according to the
specified page size) of search results. With this approach, it's impossible for the
page formatter to determine whether an additional page is useful when a result set no
smaller than the requested size is returned.

Post-patch: The solution is to request an extra result, which we do not display, but we
do include in our result count. Display of the extra result is avoided by modifying
SpecialSearch->showMatches() to explicitly honor the limit property of its calling
instance. The criterion for not linking to a next page is then updated from
 results < limit.
which enables the next link whenever the current results page is full, to
 results <= limit
which enables the next link only when there will be results displayed on the next page.

Bug: 19938
Change-Id: Ic30586e217fbde4b9d0aeda277a77030c4dce216
includes/specials/SpecialSearch.php