mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged searchapi (5.2.1) to 5.2.N (5.2.1)
129787 gjames: SEARCH-114: No default paging. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@130176 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -88,7 +88,7 @@ public class SearchApiWebscript extends AbstractWebScript implements RecognizedP
|
||||
SearchQuery searchQuery = extractJsonContent(webScriptRequest, assistant.getJsonHelper(), SearchQuery.class);
|
||||
|
||||
//Parse the parameter
|
||||
Params.RecognizedParams recognizedParams = new Params.RecognizedParams(null, searchQuery.getPaging(), null, null, null, null, null, null, false);
|
||||
Params.RecognizedParams recognizedParams = new Params.RecognizedParams(null, null, null, null, null, null, null, null, false);
|
||||
Params params = Params.valueOf(null, recognizedParams, searchQuery, webScriptRequest);
|
||||
|
||||
//Turn the params into the Java SearchParameters object
|
||||
|
@@ -31,6 +31,7 @@ import org.alfresco.rest.api.Nodes;
|
||||
import org.alfresco.rest.api.model.Node;
|
||||
import org.alfresco.rest.api.model.UserInfo;
|
||||
import org.alfresco.rest.api.search.model.SearchEntry;
|
||||
import org.alfresco.rest.api.search.model.SearchQuery;
|
||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Paging;
|
||||
import org.alfresco.rest.framework.resource.parameters.Params;
|
||||
@@ -73,6 +74,7 @@ public class ResultMapper
|
||||
*/
|
||||
public CollectionWithPagingInfo<Node> toCollectionWithPagingInfo(Params params, ResultSet results)
|
||||
{
|
||||
SearchQuery searchQuery = (SearchQuery) params.getPassedIn();
|
||||
Long totalItems = results.getNumberFound();
|
||||
List<Node> noderesults = new ArrayList();
|
||||
|
||||
@@ -86,7 +88,8 @@ public class ResultMapper
|
||||
);
|
||||
|
||||
Integer total = Integer.valueOf(totalItems.intValue());
|
||||
return CollectionWithPagingInfo.asPaged(params.getPaging(), noderesults, noderesults.size() + params.getPaging().getSkipCount() < total, total);
|
||||
int skip = searchQuery.getPaging()==null?0:searchQuery.getPaging().getSkipCount();
|
||||
return CollectionWithPagingInfo.asPaged(searchQuery.getPaging(), noderesults, noderesults.size() + skip < total, total);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -34,6 +34,7 @@ import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Paging;
|
||||
import org.alfresco.rest.framework.resource.parameters.Params;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.search.LimitBy;
|
||||
import org.alfresco.service.cmr.search.ResultSet;
|
||||
import org.alfresco.service.cmr.search.SearchParameters;
|
||||
import org.alfresco.rest.api.model.Node;
|
||||
@@ -64,7 +65,7 @@ public class SearchMapper
|
||||
ParameterCheck.mandatory("query", searchQuery.getQuery());
|
||||
|
||||
SearchParameters sp = new SearchParameters();
|
||||
fromQuery(sp, searchQuery.getQuery());
|
||||
fromQuery(sp, searchQuery.getQuery());
|
||||
fromPaging(sp, searchQuery.getPaging());
|
||||
|
||||
//Hardcode workspace store
|
||||
@@ -106,6 +107,7 @@ public class SearchMapper
|
||||
{
|
||||
if (paging != null)
|
||||
{
|
||||
sp.setLimitBy(LimitBy.FINAL_SIZE);
|
||||
sp.setMaxItems(paging.getMaxItems());
|
||||
sp.setSkipCount(paging.getSkipCount());
|
||||
}
|
||||
|
Reference in New Issue
Block a user