int recordCount = solrSearchResult.size();
SearchResult searchResult = new SearchResult();
PresentationControlParameters presentationControlParameters =
new PresentationControlParameters();
if (recordCount == (rows + 1))
{
presentationControlParameters.setMoreRecordsAvailable(true);
solrSearchResult.remove(recordCount - 1);
recordCount = recordCount - 1;
}
if (solrSearchResult.size() > 0)
{
List<String> pointerLocations =
getPointerLocations(solrSearchResult);
// Get Pointers
Pointers pointers = getPointers(pointerLocations);
searchResult.setPointers(pointers);
}
else
{
searchResult.setEmpty(new Empty());
}
// Set SearchResults
searchResult.setSearchItems(searchItems);
presentationControlParameters.setReturnedRecordCount(BigInteger
.valueOf(recordCount));
presentationControlParameters.setTotalRecordCount(BigInteger
.valueOf(solrSearchResult.getNumFound()));
presentationControlParameters
.setRequestedStartOffset(BigInteger
.valueOf(startOffSet));
presentationControlParameters.setRequestedEndOffset(BigInteger
.valueOf(endOffset));
presentationControlParameters.getSort().addAll(
searchRequest.getPresentationControlParameters().getSort() );
searchResult
.setPresentationControlParameters(presentationControlParameters);
// Return Document
return marshal(searchResult);