Solr是否具有读取schema.xml的API? [英] Does Solr have an API to read schema.xml?

查看:54
本文介绍了Solr是否具有读取schema.xml的API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何Solr API可以读取Solr schema.xml?

Is there any Solr API to read the Solr schema.xml?

我需要它的原因是Solr构面不向后兼容.如果索引没有定义字段A,但是程序尝试为字段A生成构面,则所有构面都会失败.因此,我需要在运行时检查索引中包含哪些字段,并动态生成构面.

The reason I need it is that Solr faceting is not backwards compatible. If the index doesn't define field A, but the program tries to generate facets for field A, all the facets will fail. Therefore I need to check in the runtime what fields we have in the index, and generate the facets dynamically.

推荐答案

您可以使用 http://localhost:8983/solr/admin/file/?contentType = text/xml; charset = utf获取架构-8& file = schema.xml

这是原始的xml,因此必须对其进行解析以获取所需的信息.

It's the raw xml, so have to parse it to get the information you need.

但是,如果您的程序生成了无效的构面,则也许您应该只修复该程序,而不要尝试解决此问题.

However, if your program generates an invalid facet, maybe you should just fix the program instead of trying to work around this.

这篇关于Solr是否具有读取schema.xml的API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆