The ranking and sorting you define for a search logic controls the order in which hits display in the search results.
There are two phases in ranking and sorting: calculating the ranking elements, then defining sorting and grouping using these ranking elements.
About Ranking Sorting