Change SharePoint search results FullTextSqlQuery RowLimit 10000


SharePoint provides the great capability of discovering contents, discussions, people, etc from your SharePoint environment, which leverages the Search service. Though this is a quite useful feature, there are a few limitations that sometimes need to be handled in order to meet the requirements and desired results/output.

Maximum search results returned limitation

SharePoint 2010 search has a default limit of 10000 maximum results for the submitted queries.

This is something the developer might not be aware of initially but will encounter an exception if tried to get results more than 10000 results using the RowLimit of FullTextSqlQuery.

If RowLimit is not specified, only 50 results will be returned by default.

See the below line from developer code.

query.RowLimit = 15000;
ResultTableCollection queryResults = query.Execute();

In this code, the developer wants to get 15000 results for the provided query, but the code throws an exception as Exception from HRESULT: 0x80040E01.

This is because the default limit set by SharePoint is 10000, moreover this cannot be changed through Central Administration. One way to change this setting is by using below PowerShell command.

$ssa = Get-SPEnterpriseSearchServiceApplication
$ssa.UpdateSetting("Config:qp_MaxResultsReturned", 15000)
$ssa.Update()

Perform IISRESET

Now if the above code is executed, the query will return a maximum of 15000 results. The limit can be set of 10000 again using the same PowerShell script as above and changing Config:qp_MaxResultsReturned to 10000.

Important Note

This PowerShell script will modify the related Search Service Application configuration for the entire FARM, so please consult your SharePoint Admin before making any updates. This is not recommended in live Production environments and such changes should be made only by the Admins.



















Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap