Customize your search result sorting

One of the nice features if you create your own query client with FAST Search for SharePoint is all the options to customize search result sorting. The most flexible option is the 'sort by formula' feature. As you may guess, this feature enables you to define your own formula defining how to sort your query results. Why would you want to do that? The product already gives you the ability to sort by relevance, which is computed based on a number of factors related to how well the query match your content. You can also sort by the value of managed properties, such as dates, names, etc. However, in some cases you may have a more specific sorting requirement that is not covered by numeric or text sorting.

The probably most relevant use case for this feature is sorting by geographical distance. Given that you can supply your own position with latitude/longitude for the query, and the indexed items also includes this information, you can create a formula that can sort by distance from your own position to the position given in the indexed item.

Another possible use case is to sort by the value of a managed property, but map the values to given buckets before sorting. Then you can use this in a multi-level sorting specification, and apply some other sorting mechanism for values within the same bucket.

You can find more detailed syntax description, examples, and information on how to use the feature from the query web service in this article: