使用 Jackson 连接到 Amazon CloudSearch,后者以 SDF 格式提取数据。这是一个例子:
[ {
"type" : "add",
"id" : "images_to_search_csv_1",
"version" : 1336526759,
"lang" : "en",
"fields" : {
"content" : "http://upload.wikimedia.org/wikipedia/commons/thumb/4/43/Timba%2B1.jpg/220px-Timba%2B1.jpg",
"title" : "Simba",
"source" : "wikipedia",
"description" : "Simba the wolf dog.",
"type" : "Image"
}
}, {
"type" : "add",
"id" : "images_to_search_csv_2",
"version" : 1336526760,
"lang" : "en",
"fields" : {
"content" : "http://www.wolfzone1.com/photos/sedona-01d%20copy.jpg",
"title" : "Wolf",
"source" : "Wolf Zone",
"description" : "Another wolf.",
"type" : "Image"
}
} ]
请注意,这些字段是您提交的实体的字段。很明显,如果你只是将该实体绑定到 SDF 类,你会得到实体,然后是它的字段,但文件的结构最终会有所不同。我应该只编写代码以手动输出而不是让杰克逊来做吗?