While using SharePoint Search REST Api I encountered the following problem, if I use different rowlimit
values, the totalrows
property varies it value. For example, with such request:
http://my-site/_api/search/query?querytext='test'&rowlimit=10
I got following response:
<d:RowCount m:type="Edm.Int32">10</d:RowCount>
<d:Table m:type="SP.SimpleDataTable"></d:Table>
<d:TotalRows m:type="Edm.Int32">22</d:TotalRows>
On the other hand, with this request http://my-site/_api/search/query?querytext='test'&rowlimit=5
I acquire this:
<d:RowCount m:type="Edm.Int32">5</d:RowCount>
<d:Table m:type="SP.SimpleDataTable"></d:Table>
<d:TotalRows m:type="Edm.Int32">28</d:TotalRows>
I've done a check with CSOM Api and it returns the same values as REST:
using (var clientContext = new ClientContext(_url))
{
var keywordQuery = new KeywordQuery(clientContext)
{
QueryText = "test",
RowLimit = 10 //and then 5
};
var searchExecutor = new SearchExecutor(clientContext);
var results = searchExecutor.ExecuteQuery(keywordQuery);
clientContext.ExecuteQuery();
Console.WriteLine("total rows: {0}", results.Value[0].TotalRows); // 22 and then 28
}
Why it happens so and how could I solve this problem?