简体   繁体   English

如何使用Boto将我的cloudsearch限制在特定领域?

[英]How can I limit my cloudsearch to a specific field using Boto?

I need to do a cloudsearch on only one of my domain's index fields. 我只需要对我域的索引字段之一进行cloudsearch。 For example, I need all of the results where 'title' contains 'star wars'. 例如,我需要所有包含“标题”包含“星球大战”的结果。 Is this possible using Boto? 使用Boto可以吗?

According to the AWS Docs , you need to utilize the 'q.options' parameter: 根据AWS Docs ,您需要利用'q.options'参数:

q=star wars&q.options={fields: ['title']}

However, it appears that Boto doesn't support that parameter: 但是,看来Boto不支持该参数:

def search(self, q=None, bq=None, rank=None, return_fields=None,
               size=10, start=0, facet=None, facet_constraints=None,
               facet_sort=None, facet_top_n=None, t=None):

Is it possible to search by only one field using Boto? 是否可以使用Boto仅按一个字段进行搜索?

You want to be using the boto cloudsearch2 API (note the '2'), which is equivalent to the AWS CloudSearch version 2013-01-01 and has an options param. 您想要使用boto cloudsearch2 API(注意为“ 2”),该API等效于AWS CloudSearch版本2013-01-01,并具有options参数。

search(q=None, parser=None, fq=None, rank=None, return_fields=None,
           size=10, start=0, facet=None, highlight=None, sort=None,
           partial=None, options=None)

The doc for the options param: 选项参数的文档:

options (str) – Options for the query parser specified in parser. options(str)–解析器中指定的查询解析器的选项。 Specified as a string in JSON format. 指定为JSON格式的字符串。 {fields: ['title^5', 'description']} {fields:['title ^ 5','description']}

http://boto.readthedocs.org/en/latest/ref/cloudsearch2.html http://boto.readthedocs.org/en/latest/ref/cloudsearch2.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM