cancel
Showing results for 
Search instead for 
Did you mean: 

setting max search results

roth
Champ in-the-making
Champ in-the-making
How can I set the search limit for a query? I want to return all results, as shown in the code below:

        SearchService searchService = serviceRegistry.getSearchService();
        StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");

        SearchParameters sp = new SearchParameters();
        sp.addStore(storeRef);
        sp.setLanguage(SearchService.LANGUAGE_LUCENE);
        sp.setQuery("TYPE:\"" + type + "\"");
        sp.setLimitBy(LimitBy.UN*LIMI*TED); // the *-signs are a workaround for the spam filter
        results = searchService.query(sp);

However, this does work, the result set maximum is always 1000 results.
Setting the search-max-results limit to -1 in web-client-config.xml or a custom version does not work either.
1 REPLY 1

derek
Star Contributor
Star Contributor
Hi,
# The maximum time spent pruning results
system.acl.maxPermissionCheckTimeMillis=10000
# The maximum number of results to perform permission checks against
system.acl.maxPermissionChecks=1000
You're hitting another limit here.  The properties above control how many permission checks get performed and how long permission checks should go on for a given set of search results.  As the permission checking of potentially large search results is an intesive process, the system admin can limit this in order to control resources and prevent individual users from generating queries that consume too much of the system's CPU resource.  This is particularly an issue with single CPU machines.

You can just override the properties in your custom-repository.properties as required.

Regards