We have a situation (SharePoint Server 2013 Search) where we have implemented a search results page using the API. We are building a KeywordQuery object and setting the QueryText.

We are setting the sort order as follows:

kq.SortList.Add("Title", Microsoft.Office.Server.Search.Query.SortDirection.Ascending);

Does anybody know why the following would occur? We get different numbers of results based on the ordering direction and type. All are run with exactly the same query:

Ordered by relevance rank (default): 249 results
Ordered by Title ascending: 250 results
Ordered by Title descending: 250 results
Ordered by Created ascending: 249 results
Ordered by Created descending: 250 results

We are counting the Rows.Count method applied to the DataTable generated by the SearchExecutor as follows:

SearchExecutor searchExecutor = new SearchExecutor();

ResultTableCollection resultTableCollection = searchExecutor.ExecuteQuery(kq);

IEnumerable<ResultTable> resultTables = resultTableCollection.Filter("TableType", KnownTableTypes.RelevantResults);
var resultTable = resultTables.FirstOrDefault();
resultDataTable = resultTable.Table;

int totalResults = resultDataTable.Rows.Count;

Any advice would be greatly appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.