When examine matches a document from your search term, it also calculates a 'score' indicating how well the document matches the term, and it is by this score that Examine orders the results, eg the most relevant match first.
When you are building your custom examine query you can add the OrderBy or OrderByDescending option at the end to specify the field to order by.
eg:
var searcher = ExamineManager.Instance.SearchProviderCollection["ExternalSearcher"];
var criteria = searcher.CreateSearchCriteria(BooleanOperation.Or);
var searchTerm = "fish"; //or read from form post / querystring etc
//build other criteria for your search
var query = criteria.Field("bodyText",searchTerm).Or().Field("title",searchTerm);
// ordering
query.And().OrderByDescending(new string[] {"title"});
//compile and get results
var results = searcher.Search(query.Compile());
Examine search result default sort order
Hello,
What is the default sort order when we use Examine mechanism?
How the data will be sorted, based on ID or any text.
can anyone guide me what will be the default order and can we customize the default result order?
Hi Nilesh
When examine matches a document from your search term, it also calculates a 'score' indicating how well the document matches the term, and it is by this score that Examine orders the results, eg the most relevant match first.
When you are building your custom examine query you can add the OrderBy or OrderByDescending option at the end to specify the field to order by.
eg:
Thanks for the reply.
But how score is calculated?
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.