I am trying to get a list of all components based on a schema which are like 2000+ via core service. when using code from How to get all Components based on a Schema and from a particular Publication? its returns only top 1000. Any other way to get all the components. I know there will be timeouts and it will be heavy, but this is a one time run application.
2 Answers
As your query uses the underlying Tridion search functionality, it is processed using the standard Solr request handler.
In the [Tridion Home]\solr-home\tridion\conf\solrconfig.xml file, this request handler is set to return a maximum of 1000 rows:
<requestHandler name="standard" class="solr.SearchHandler" default="true">
<lst name="defaults">
<str name="echoParams">explicit</str>
<str name="defType">complex</str>
<int name="rows">1000</int>
</lst>
</requestHandler>
If you expect your CME queries to need to return more than 1000 results, this rows
setting can be increased.
You may need to restart Solr's application server, or run the Reload command to get changes to take effect.
You don't have to use Search for this. A where used query will also work, and might be the better choice. Here's a powershell snippet to illustrate how you might do this:
$core = Get-TridionCoreServiceClient
$filter = new-object Tridion.ContentManager.CoreService.Client.UsingItemsFilterData
$filter.ItemTypes = "Component"
$components = $core.GetList("tcm:28-587-8", $filter) | %{$core.Read($_.Id,$null)}
-
I agree with Dominic that the where used query is a better option here - as it doesn't rely on the Solr search indexes being up to date. Sep 2, 2016 at 9:28
-