Cloudsearch 2013 API:术语权重导致查询 return 没有结果

Cloudsearch 2013 API: term weights causing queries to return no results

我一直在尝试使用 cloudsearch 进行一些术语加权以改善搜索结果。以前,如果我有这样的搜索查询:

q=(and (or 'JUN/2015' (prefix 'JUN/2015')))&q.parser=structured

...我会得到 4650 个结果。我更新了查询,通过将此添加到我的查询中来增加与特定字段的相关性:

q.options={fields:['name^2']}

...但现在上面的相同查询 returns 没有结果。

为什么术语权重会影响查询,以至于它不会导致返回任何内容?

fields 选项不仅控制提升,还控制搜索哪些字段。因此,通过指定 q.options={fields:['name^2']},您只搜索 name 字段,并且您必然会得到更少的结果,因为它是一个更严格的搜索。

形成文档: http://docs.aws.amazon.com/cloudsearch/latest/developerguide/weighting-fields.html

In addition to controlling field weights, the fields option defines the set of fields that are searched by default if you use the simple query parser or don't specify a field in part of a compound expression when using the structured query parser. For more information, see Search Request Parameters in the Search API Reference.

因此,解决此问题的方法是在复合查询或 fields 选项中指定其他字段。更多关于搜索特定字段的文档:

http://docs.aws.amazon.com/cloudsearch/latest/developerguide/searching-text.html#searching-text-terms

By default, all text and text-array fields are searched when you use the simple query parser. You can specify which fields you want to search by specifying the q.options parameter. For example, this query constrains the search to the title and description fields and boosts the importance of matches in the title field over matches in the description field.

q=star wars&q.options={fields: ['title^5','description']}