简体   繁体   English

vespa json object 更改为字符串

[英]vespa json object changes to string

i have vespa verion 5.220.14 installed in one server where i have used json (provided by gson lib ) in searcher, while i am deploying the same code in vespa version 5.550 in a diffrentserver it is not working and changing it to string.我在搜索器中使用了 json (由 gson lib 提供)的一台服务器上安装了 vespa 版本 5.220.14,而我在 vespa 版本 5.550 中部署相同的代码并在不同的服务器中将其更改为不起作用的字符串。 Attached are the screenshot for same.附件是相同的屏幕截图。 What could be the possible reason for same, And what should be resolution to make this work.可能的原因是什么,以及使这项工作发挥作用的解决方案是什么。 安装 vespa 5.550 的服务器中的结果

vespa 版本为 5.220.14 的服务器中对象中 dtaa 类型的结果

special-handling of org.json in rendering was removed one year ago:渲染中 org.json 的特殊处理在一年前被删除:

https://github.com/vespa-engine/vespa/pull/16326/files#diff-8cff528a21faf96a6e90b1490adc25ff474ad72e973627ee4e8b9734084ad86f https://github.com/vespa-engine/vespa/pull/16326/files#diff-8cff528a21faf96a6e90b1490adc25ff474ad72e973627ee4e8b9734084ad86f

you should probably wrap your "data" field in a facade that implements the com.yahoo.data.JsonProducer interface:您可能应该将“数据”字段包装在实现 com.yahoo.data.JsonProducer 接口的外观中:

https://javadoc.io/doc/com.yahoo.vespa/container-search/latest/com/yahoo/data/JsonProducer.html https://javadoc.io/doc/com.yahoo.vespa/container-search/latest/com/yahoo/data/JsonProducer.html

Arne is correct, we had to move this due to the license of org.json, sorry for the inconvenience. Arne 是正确的,由于 org.json 的许可,我们不得不移动它,对于给您带来的不便,我们深表歉意。

To implement Arne's solution, all you need is to replace hit.setField("data", newroot);要实现 Arne 的解决方案,您只需要替换 hit.setField("data", newroot); in your code by在你的代码中

hit.setField("data", (com.yahoo.data.JsonProducer)s -> s.append(resdata));

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

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