fix #2706 set requestPageSize

This commit is contained in:
Shinsuke Sugaya 2023-01-04 18:04:59 +09:00
parent 9506bd0390
commit 88c9959a7d
2 changed files with 10 additions and 5 deletions

View file

@ -400,6 +400,8 @@ public class Constants extends CoreLibConstants {
public static final String REQUEST_LANGUAGES = "requestLanguages";
public static final String REQUEST_PAGE_SIZE = "requestPageSize";
public static final String SEARCH_PREFERENCE_LOCAL = "_local";
public static final String GSA_API_VERSION = "3.2";

View file

@ -162,13 +162,16 @@ public class SearchHelper {
final FessConfig fessConfig = ComponentUtil.getFessConfig();
final QueryHelper queryHelper = ComponentUtil.getQueryHelper();
final QueryFieldConfig queryFieldConfig = ComponentUtil.getQueryFieldConfig();
final int pageSize = params.getPageSize();
LaRequestUtil.getOptionalRequest().ifPresent(request -> {
request.setAttribute(Constants.REQUEST_PAGE_SIZE, pageSize);
});
return ComponentUtil.getSearchEngineClient().search(fessConfig.getIndexDocumentSearchIndex(), searchRequestBuilder -> {
queryHelper.processSearchPreference(searchRequestBuilder, userBean, query);
return SearchConditionBuilder.builder(searchRequestBuilder).query(query).offset(params.getStartPosition())
.size(params.getPageSize()).facetInfo(params.getFacetInfo()).geoInfo(params.getGeoInfo())
.highlightInfo(params.getHighlightInfo()).similarDocHash(params.getSimilarDocHash())
.responseFields(queryFieldConfig.getResponseFields()).searchRequestType(params.getType())
.trackTotalHits(params.getTrackTotalHits()).build();
return SearchConditionBuilder.builder(searchRequestBuilder).query(query).offset(params.getStartPosition()).size(pageSize)
.facetInfo(params.getFacetInfo()).geoInfo(params.getGeoInfo()).highlightInfo(params.getHighlightInfo())
.similarDocHash(params.getSimilarDocHash()).responseFields(queryFieldConfig.getResponseFields())
.searchRequestType(params.getType()).trackTotalHits(params.getTrackTotalHits()).build();
}, (searchRequestBuilder, execTime, searchResponse) -> {
searchResponse.ifPresent(r -> {
if (r.getTotalShards() != r.getSuccessfulShards() && fessConfig.isQueryTimeoutLogging()) {