Sitecore ContentSearch is not providing result in the same order like Solr query does.
http://localhost:8983/solr/sitecore_web_index/select?indent=on&q=_content:testorder&wt=json
we are getting result in the following order
- x
- y
- z
but when we use ContentSearch API we are getting results in different order.
var results = Sitecore.ContentSearch.ContentSearchManager.GetIndex("sitecore_web_index").CreateSearchContext().GetQueryable<Sitecore.ContentSearch.SearchTypes.SearchResultItem>().Where(x => x.Content.Contains("testorder")
when we iterate the list, we get different order:
- y
- x
- z
How can I get results from ContentSearch in the same order as Solr?
ContentSearch
code in your question? (You can find this by checking the Search logs in your data folder:/data/logs/Search.log.DDDDDDDD.TTTTTT.txt
.) My guess is that it's a different underlying query which causes the difference in result order.