Skip to content

Instantly share code, notes, and snippets.

@cmlewis
Created October 30, 2014 14:58
Show Gist options
  • Save cmlewis/09b13f16d1c40f459939 to your computer and use it in GitHub Desktop.
Save cmlewis/09b13f16d1c40f459939 to your computer and use it in GitHub Desktop.
Execute an Alfresco search with unlimited results and permissions checks. Bypasses the configured max search limit (default is 1000).
// Set up search params with unlimited results
SearchParameters sp = new SearchParameters();
sp.setLanguage(SearchService.LANGUAGE_LUCENE); // Can be lucene, FTS, CMIS, etc.
sp.setQuery(query);
sp.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
sp.setMaxItems(Integer.MAX_VALUE);
sp.setMaxPermissionChecks(Integer.MAX_VALUE);
// Execute query.
ResultSet resultSet = searchService.query(sp);
for (NodeRef result : resultSet.getNodeRefs()) {
// Do stuff
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment