Boto AWS CloudSearch返回排名/分数

时间:2013-01-17 06:43:51

标签: boto amazon-cloudsearch

我正在使用Boto的CloudSearch API来查询CloudSearch索引。我找不到检索每个搜索结果的排名/分数的方法。有可能吗?

1 个答案:

答案 0 :(得分:0)

将rank表达式的名称添加到return_fields参数:

import boto
conn = boto.connect_cloudsearch(key,secret)
domain = conn.create_domain('domain_name')
search_service = domain.get_search_service()

results = search_service.search(query, return_fields=['text_relevance','name_of_custom_rank_expression'])

for result in results:
    score = result['data']['name_of_custom_rank_expression'][0]