Amazon CloudSearch
Developer Guide (API Version 2011-02-01)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

Defining Amazon CloudSearch Rank Expressions in Search Requests

You can define a query time rank expression by specifying the rank-RANKNAME parameter. You can use the rank expression to rank results for that request or set a threshold for the search results. The rank expression can also be specified as a return field or used in the definition of another rank expression. Existing rank expressions can be overridden by specifying the name of the expression you want to override as the RANKNAME.

When you define a rank expression within a search request, it is not stored as part of your domain configuration. If you want to use the rank expression in other requests, you must define the rank expression in each request or add the rank expression to your domain configuration, as described in Defining Amazon CloudSearch Rank Expressions in a Domain Configuration.

Defining a rank expression in a search request enables you to quickly test and tune rank expressions. Once you have finished tuning a rank expression, you should configure it for use in all requests by adding it to your domain configuration. Defining the rank expression in every request increases the request overhead and can result in slower response times and potentially increase the cost of running your domain.

You can define and use multiple rank expressions in a search request. The definition of a rank expression can reference other rank expressions defined within the request, as well as expressions configured as part of the domain configuration. For example, the following request creates two rank expressions that are used to rank the results and returns one of them in the search results:

search?q=terminator&rank-expression1=sin(text_relevance)&rank-expression2=cos(text_relevance)&rank=expression1,expression2&return-fields=title,text_relevance,expression2