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...

Constraining Search Results in Amazon CloudSearch

To use a rank expression as a threshold constraint for the search results, you use the threshold option in your search requests. The threshold option is specified as t-RANKNAME. When using the threshold option, you can specify an exact value, or a range of values. Ranges are specified as a pair of nonnegative integers separated by two dots, for example 50..100. To specify an open-ended upper or lower limit, you can omit one value. For example, you could specify 50.. to set the threshold to 50 or greater.

For example, to only include results for which the is_available rank expression evaluates to 1 (true), you could use the is_available rank expression as a threshold:

search?q=star+wars&return-fields=title&&rank=-custom_relevance&t-is_available=1

In this example, the results are ranked using a rank expression called custom_relevance.

You can also set thresholds based on the default text_relevance score. A document's text_relevance score is in the range 0-1000. To limit the results to documents that have a text_relevance score of at least 500, you could specify:

search?q=star+wars&return-fields=title&t-text_relevance=500..