我在我的应用程序中创建了一个包含多个文档的 Searcher 类。在 Searcher 类中,我想将文档写入特定类型的文档。但这并没有反映在 Vespa 中。我的代码如下:
public Result search(Query query, Execution execution) {
Result result = execution.search(query);
DocumentAccess access = DocumentAccess.createDefault();
DocumentType type = access.getDocumentTypeManager().getDocumentType("location");
DocumentId id = new DocumentId("id:location:location::4");
Document document = new Document(type, id);
document.setFieldValue("token", "qwerty");
document.setFieldValue("latlong", "12.343,12.4343");
document.setFieldValue("data_timestamp", "00:00:00 00:00:00");
// return the result up the chain
return result;
}
在这里,我正在将文档写入位置类型。我的 Location.sd 类:
search location
{
document location {
field token type string {
indexing: index
}
field latlong type string {
indexing: attribute
}
field data_timestamp type string {
indexing: attribute
}
}
fieldset default {
fields: token
}
}
当我想使用以下方式获取文档时: http://localhost:8080/document/v1/location/location/docid/4
I got the result:
{
"id": "id:location:location::4",
"pathId": "/document/v1/location/location/docid/4"
}
我应该得到以下输出:
{
"fields": {
"token": "qwerty",
"latlong": "12.343,12.4343",
"data_timestamp": "00:00:00 00:00:00"
},
"id": "id:location:location::4",
"pathId": "/document/v1/location/location/docid/4"
}
请帮助我解决我做错了什么或遗漏了什么。