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)
130038 gjames: SEARCH-158: Limit results by a final size of 100 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@130294 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -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());
|
||||||
|
Reference in New Issue
Block a user