如何在Solr中编写嵌套的schema.xml? [英] How to write nested schema.xml in solr?
本文介绍了如何在Solr中编写嵌套的schema.xml?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在solr中编写嵌套的schema.xml
How to write nested schema.xml in solr
schema.xml中的文档显示
The document in schema.xml says
<!-- points to the root document of a block of nested documents. Required for nested
document support, may be removed otherwise
-->
<field name="_root_" type="string" indexed="true" stored="false"/>
可用于
嵌套以下项目的schema.xml是什么:
What will be schema.xml for nesting the following items:
- 人员字符串
- 地址
- 城市字符串
- 邮政编码字符串
推荐答案
I知道这是一个老问题,但是我遇到了类似的问题。修改我的解决方案后,您需要添加到schema.xml中的字段如下:
I know this is an old question, but I ran into a similar issue. Modifying my solution for yours, the fields you need to add to your schema.xml are as follows:
<field name="person" type="string" indexed="true" stored="true" /> <field name="address" type="string" indexed="true" stored="true" multiValued="true"/> <field name="address.city" type="string" indexed="true" stored="true" /> <field name="address.postcode" type="string" indexed="true" stored="true" />
然后,在运行它时,您应该可以将以下JSON添加到Solr实例中并查看匹配查询中的输出:
Then when you run it you should be able to add the following JSON to your Solr instance and see the matching output in the query:
{ "person": "John Smith", "address": { "city": "San Diego", "postcode": 92093 } }
这篇关于如何在Solr中编写嵌套的schema.xml?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文