Merged 5.2.N (5.2.1) to HEAD (5.2)

131073 gjames: SEARCH-189: Always return skipCount and maxItems


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@132213 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2016-11-03 13:30:45 +00:00
parent df49027de6
commit 04c7261d59
8 changed files with 182 additions and 32 deletions

View File

@@ -34,10 +34,10 @@ import org.alfresco.rest.api.search.context.FacetFieldContext;
import org.alfresco.rest.api.search.context.FacetFieldContext.Bucket;
import org.alfresco.rest.api.search.context.SpellCheckContext;
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.api.search.context.SearchContext;
import org.alfresco.rest.api.search.context.FacetQueryContext;
import org.alfresco.rest.framework.resource.parameters.Params;
import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.SpellCheckResult;
import org.alfresco.util.Pair;
@@ -74,7 +74,7 @@ public class ResultMapper
* @param results
* @return CollectionWithPagingInfo<Node>
*/
public CollectionWithPagingInfo<Node> toCollectionWithPagingInfo(SearchQuery searchQuery, ResultSet results)
public CollectionWithPagingInfo<Node> toCollectionWithPagingInfo(Params params, ResultSet results)
{
SearchContext context = null;
Integer total = null;
@@ -83,7 +83,7 @@ public class ResultMapper
results.forEach(row ->
{
Node aNode = nodes.getFolderOrDocument(row.getNodeRef(), null, null, searchQuery.getInclude(), mapUserInfo);
Node aNode = nodes.getFolderOrDocument(row.getNodeRef(), null, null, params.getInclude(), mapUserInfo);
if (aNode != null)
{
float f = row.getScore();
@@ -115,7 +115,7 @@ public class ResultMapper
}
}
return CollectionWithPagingInfo.asPaged(searchQuery.getPaging(), noderesults, results.hasMore(), total, null, context);
return CollectionWithPagingInfo.asPaged(params.getPaging(), noderesults, results.hasMore(), total, null, context);
}
/**

View File

@@ -41,6 +41,7 @@ import org.alfresco.rest.api.search.model.Spelling;
import org.alfresco.rest.api.search.model.Template;
import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException;
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.SearchParameters;
@@ -84,7 +85,7 @@ public class SearchMapper
* @param params
* @return SearchParameters
*/
public SearchParameters toSearchParameters(SearchQuery searchQuery)
public SearchParameters toSearchParameters(Params params, SearchQuery searchQuery)
{
ParameterCheck.mandatory("query", searchQuery.getQuery());
@@ -92,7 +93,7 @@ public class SearchMapper
setDefaults(sp);
fromQuery(sp, searchQuery.getQuery());
fromPaging(sp, searchQuery.getPaging());
fromPaging(sp, params.getPaging());
fromSort(sp, searchQuery.getSort());
fromTemplate(sp, searchQuery.getTemplates());
validateInclude(searchQuery.getInclude());
@@ -115,8 +116,6 @@ public class SearchMapper
{
//Hardcode workspace store
sp.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
sp.setLimitBy(LimitBy.FINAL_SIZE);
sp.setLimit(100);
}
/**