Integer resultOffset = Integer.valueOf(resultOffsetInt);
Integer maxResults = Integer.valueOf(maxResultsInt);
ResultSortOrder resultSortOrder = ProductSearchOptions.getResultSortOrder(request);
ProductSearchContext productSearchContext = new ProductSearchContext(delegator, visitId);
if (UtilValidate.isNotEmpty(productSearchConstraintList)) {
productSearchContext.addProductSearchConstraints(productSearchConstraintList);
}
productSearchContext.setResultSortOrder(resultSortOrder);
productSearchContext.setResultOffset(resultOffset);
productSearchContext.setMaxResults(maxResults);
if (UtilValidate.isNotEmpty(keywordTypeIds)) {
productSearchContext.keywordTypeIds = keywordTypeIds;
} else {
productSearchContext.keywordTypeIds = UtilMisc.toList("KWT_KEYWORD");
}
if (UtilValidate.isNotEmpty(statusId)) {
productSearchContext.statusId = statusId;
}
List<String> foundProductIds = productSearchContext.doSearch();
if (maxResultsInt > 0) {
productIds.addAll(foundProductIds);
}
Integer totalResults = productSearchContext.getTotalResults();
if (totalResults != null) {
listSize = listSize + totalResults.intValue();
}
}