4

我正在查看 Amazon CloudSearch,我只是担心每列有多个值,以及它是否会被 CloudSearch 视为一个单独的方面。我的意思是,如果我有一本书(1 行)并且它有多个作者,但只有一个author字段,那么分面搜索如何将每个作者作为单独的方面返回?必须设置一组硬编码的作者字段(即.. author1, author2, author3)并不实用,所以我想知道它是否是内置的?

我没有看到它被支持,但是我又不知道一切。我看到它的方式可以接受某种 CSV 值或 XML?

我的意思的一个例子是,如果我将这个数据集存储在 CloudSearch 上:

   title        |  author
   I am a book  |  Bob Jones, Mike Miller

但这些将是返回的方面:

   author
     -Bob Jones
     -Mike Miller

有什么方法可以实现这样的目标吗?

4

1 回答 1

3

一个方面完全按照你的要求做,但你不能返回一个方面。

因此,如果您将作者字段创建为构面,并且您在标题中搜索“书”并返回构面“作者”

/search?q=book&facet=作者

你会得到:鲍勃·琼斯 (1) 和迈克·米勒 (1) 击中 1 次。表示有一本给 Bob 的书和一本给 Mike 的书(在你的情况下是同一本书)。

但是缺少的是“作者”字段,您的方面绝不会表明两位作者都属于同一本书。您也不能随书一起显示作者,除非您添加一个额外的字段,在一个字符串或 author1 author2 中列出作者。

As for how to insert multiple values for one field, an array, I use the method of posting a json object to /documents/batch. The author field would simply have an array with one or more values (an empty array is not allowed, an empty string is, a book with no authors must be an empty string, not an empty array in your json object).

于 2014-02-05T09:52:50.033 回答