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

130294 gjames: Merged searchapi (5.2.1) to 5.2.N (5.2.1)
      130038 gjames: SEARCH-158: Limit results by a final size of 100


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@130366 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2016-09-06 22:09:59 +00:00
parent b67a546851
commit be1ae9146e
2 changed files with 6 additions and 0 deletions

View File

@@ -106,6 +106,8 @@ public class SearchMapper
{ {
//Hardcode workspace store //Hardcode workspace store
sp.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); sp.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
sp.setLimitBy(LimitBy.FINAL_SIZE);
sp.setMaxItems(100);
} }
/** /**

View File

@@ -44,6 +44,7 @@ import org.alfresco.rest.api.search.model.Template;
import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException; import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException;
import org.alfresco.rest.framework.resource.parameters.Paging; import org.alfresco.rest.framework.resource.parameters.Paging;
import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.search.LimitBy;
import org.alfresco.service.cmr.search.SearchParameters; import org.alfresco.service.cmr.search.SearchParameters;
import org.junit.Test; import org.junit.Test;
@@ -75,6 +76,8 @@ public class SearchMapperTests
//Test defaults //Test defaults
assertEquals("There should be only 1 default store", 1,searchParameters.getStores().size()); assertEquals("There should be only 1 default store", 1,searchParameters.getStores().size());
assertEquals("workspaces store is the default", StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, searchParameters.getStores().get(0)); assertEquals("workspaces store is the default", StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, searchParameters.getStores().get(0));
assertEquals(LimitBy.FINAL_SIZE, searchParameters.getLimitBy());
assertEquals(100, searchParameters.getMaxItems());
searchParameters = searchMapper.toSearchParameters(helper.searchQueryFromJson()); searchParameters = searchMapper.toSearchParameters(helper.searchQueryFromJson());
assertNotNull(searchParameters); assertNotNull(searchParameters);
@@ -141,6 +144,7 @@ public class SearchMapperTests
SearchParameters searchParameters = new SearchParameters(); SearchParameters searchParameters = new SearchParameters();
//Doesn't error //Doesn't error
searchMapper.fromPaging(searchParameters, null); searchMapper.fromPaging(searchParameters, null);
Paging paging = Paging.DEFAULT; Paging paging = Paging.DEFAULT;
searchMapper.fromPaging(searchParameters, paging); searchMapper.fromPaging(searchParameters, paging);
assertEquals(searchParameters.getMaxItems(),paging.getMaxItems()); assertEquals(searchParameters.getMaxItems(),paging.getMaxItems());