[FORWARD-PORT] LPS-51735 Proper use of search container to make sure that the total and start/end are correctly calculated

This is a forward port of https://github.com/brianchandotcom/liferay-plugins-ee/pull/10075

Note that the portlet was broken in LPS-51285 (see 426af27 in portal). I'll fix that in a different PR.

Thanks!