I am using KeywordQuery to search and the SortList does not affect search result, it always returns first 5 results. Any suggestions? The code is bellow...

using (KeywordQuery query = new KeywordQuery(site))
    var fedManager = new FederationManager(application);
    var owner = new SearchObjectOwner(SearchObjectLevel.SPSite, site.RootWeb);

    query.SourceId = fedManager.GetSourceByName("NewsRS", owner).Id;
    query.QueryText = string.Format("WorkflowStatusOWSCHCS:Approved PublishedUntilDate>=\"{0}\" OR NewsNewsPublishedDate<=\"{0}\"", DateTime.Now);
    query.KeywordInclusion = KeywordInclusion.AllKeywords;
    query.RowLimit = 5;
    query.StartRow = 1;
    query.SortList.Add("NewsNewsDate", SortDirection.Descending);
    var searchExecutor = new SearchExecutor();
    var myResults = searchExecutor.ExecuteQuery(query);
  • Is NewsNewsDate flagged as Sortable? Commented Sep 13, 2013 at 0:43
  • yes it is already there, I checked that already :-( Commented Sep 13, 2013 at 9:53
  • 1
    Have you run a full crawl on the associated content source? Have you tested sorting on an out of the box web part to ensure that everything is wired up correctly? Is date specified as a DATE type in the Managed Property? Commented Sep 15, 2013 at 20:37
  • We've checked everything, Managed Properties, mapping, nothing worked both in our environtments and in test environtment, so we decided to migrate all the queries to REST. After two days developing and testing, it is now working properly ;)
    – user19607
    Commented Sep 19, 2013 at 7:56
  • Have you checked "Reduce storage requirements for text properties by using a hash for comparison", as suggested in (stackoverflow.com/questions/3154188/…)?
    – Evariste
    Commented Apr 15, 2015 at 10:09

3 Answers 3


You are specifying the query.StartRow = 1; which will always gives you the first 5 records. Remove this option and check the search results.


this is because of the query.RowLimit=5 in your code. You limit it to give you JUST 5 results.

  • He wants 5 result, but the first 5 sorted by NewsNewsDate and not ListItemId Commented Oct 28, 2013 at 9:10
  • oh, then before adding property to sortlist clear the sortlist.
    – Ivan
    Commented Oct 28, 2013 at 10:28

Check if field NewsNewsDate is sortable = active in search properties schema.

After apply the configuration you need to run the full crawl.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.