如何在Solr中编写嵌套的schema.xml
schema.xml中的文档说
<!-- 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"/>
http://svn.apache.org/viewvc/lucene/dev/trunk/solr/example/solr/collection1/conf/schema.xml?view=markup
可用于
https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-BlockJoinQueryParsers
嵌套以下各项的schema.xml将是什么:
人字串
地址
城市字符串
邮政编码字符串
最佳答案
我知道这是一个古老的问题,但我遇到了类似的问题。为您修改我的解决方案,您需要添加到schema.xml中的字段如下:
<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实例中,并在查询中看到匹配的输出:
{
"person": "John Smith",
"address": {
"city": "San Diego",
"postcode": 92093
}
}
关于solr - 如何在Solr中编写嵌套的schema.xml?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22395683/