There seems to be a couple of different ways that people have implemented sorting in Examine.
It seems you can either set the sort on your Search Criteria like this:
Method 1
var searcher = ExamineManager.Instance.SearchProviderCollection["MySearcher"] var searchCriteria - searcher.CreateSearchCriteria(); searchCriteria.OrderBy(new[] {"__Sort_nodeName"});
Or you can get the results first and then sort on those with:
In a current project I have tested both methods. However with Method 1 above, the results seem to be inconsistent - some of the items end up out of order.
Don't know if it has anything to do with the way I build the query - I am building it up from a number of different parts using the Fluent API
Definitive way to Sort Examine Search Results
There seems to be a couple of different ways that people have implemented sorting in Examine.
It seems you can either set the sort on your Search Criteria like this:
Method 1
Or you can get the results first and then sort on those with:
Method 2
In a current project I have tested both methods. However with Method 1 above, the results seem to be inconsistent - some of the items end up out of order.
Don't know if it has anything to do with the way I build the query - I am building it up from a number of different parts using the Fluent API
query = searchCriteria.Field("Item1",MyVar)query.And().Field("Item2",MyOtherVar)
query.And().Field("Item3",etcVar)
query.And().Field("Item3",etcEtcVar)
The query could in fact end up with many different parts (up to about 40).
Does anybody know what might be going wrong with Method 1 (not sure if I have provided enough code - didn't want to just dump it)
Also which method of sorting is favoured?
J
Is this question too difficult or worded badly? No response after 2 days...??? Nobody???
I'm off to StackOF...
:-(
Did u ever work this out???
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.