如何使 SOLR 8.11.1 Ping api 调用返回 xml 而不是 json

发布于 2025-01-16 21:36:07 字数 217 浏览 3 评论 0原文

我有一个可以访问 SOLR 4.10.2 实例上的核心的应用程序。我正在更新到 SOLR 8.11.1。

我的应用程序在4.10.2中调用ping api:结果以xml格式返回。当我在 SOLR 8.11.1 中进行相同的调用时,结果以 json 格式返回。

是否有一个设置(在 solrconfig.xml 中?或在 SOLR 核心...)将 8.11.1 中的默认结果类型设置为 xml?

I have an app that accesses cores on a SOLR 4.10.2 instance. I am updating to SOLR 8.11.1.

My app calls the ping api in 4.10.2: the results are returned in xml format. When I make the same call in SOLR 8.11.1, the results are returned in json format.

Is there a setting (in solrconfig.xml? or at a SOLR core ...) that will set the default result type to xml in 8.11.1?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

风向决定发型 2025-01-23 21:36:08

响应的格式由请求中的 wt 参数管理。在您的情况下,您只需调用

http://mysolrserver/solr/mycore/admin/ping?wt=xml

即可从 SOLR 8.11.1 Ref 获得 XML 响应

solr 文档

The format of the response is managed by the wt parameter in the request. In your case you can simply call

http://mysolrserver/solr/mycore/admin/ping?wt=xml

and you'll get an XML response also from SOLR 8.11.1

Ref: solr documentation

且行且努力 2025-01-23 21:36:08

可以在核心的 solrconfig.xml 中配置默认​​的 queryResponseWriter。

我正在查看核心的 solrconfig.xml,有一个注释部分显示了如何将默认值设置为 xml:

 <queryResponseWriter name="xml"
                      default="true"
                      class="solr.XMLResponseWriter" />

我将其从注释中移出,重新加载核心,并且 ping 现在返回 xml。

The default queryResponseWriter can be configured in the solrconfig.xml for the core.

I was looking at the solrconfig.xml for the core, and there is a commented section that shows how to set the default as xml:

 <queryResponseWriter name="xml"
                      default="true"
                      class="solr.XMLResponseWriter" />

I moved it out of the comment, reloaded the core, and ping now returns xml.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文