This is currently only available for SharePoint On-Premise - i.e. SharePoint 2013 and 2016. It will become available in SharePoint Online at some point.
By default search results are returned sorted by relevance.
In the user interface
In MacroView DMF Explorer when a user runs a search a "Query" tab appears. Clicking on it allows the user to rerun the query and sort by date (oldest or newest) or relevance.
A user can also click on the column headings of the search results to re-sort the current window. I.E. if you are looking at the first 50 results this re-sorts just that 50. Note that most, not all, column headers can be sorted.
Setting search result order in a search mask
This is done in the mask header by including the SortOrder attribute. For example:
<Mask SortOrder="date (newest)" Scope="All Sites" EnableStemming="True" TrimDuplicates="False" Name="Keyword Search Sort Order">
The "SortOrder" attribute can have the following values:
- "Relevance" - this is also the default if SortOrder attribute is not supplied
- "Date (Newest)" or "write-"
- "Date (Oldest)" or "write+"
Sorting results using Number type fields
<Field Name="Size" DisplayName="Size" Type="Number"/>