![](/img/trans.png)
[英]Set multivalued fields with ContentStreamUpdateRequest in Solr
[英]Why do all the fields get set to multivalued if I am just setting one field as multivalued in Solr?
在schema.xml
我只是使用multiValued="true"
声明了一个字段具有多个值,但是当我看到*:*
查询的响应时,我得到了[]
内所有字段的值( 即特定字段是multi值的方括号,但id
字段除外。 为什么会发生这种情况,有人可以告诉我吗? 您可以在下面看到我得到的响应类型:
{
"id": "id1",
"name": ["name1"],
"gender": ["male"],
"number":["9898989898"]
}
这就是我在schema.xml
中将字段声明为多值的方式:
<field name = "id" type = "string" indexed = "true" stored = "true" required="true"/>
<field name = "name" type = "string" indexed = "true" stored = "true" required="true" multiValued="false"/>
<field name = "gender" type = "string" indexed = "true" stored = "true" required="true" multiValued="false"/>
<field name = "number" type = "string" indexed = "true" stored = "true" required="true" multiValued="true"/>
看到我以前的答案 。 由于id
是文档的uniqueKey,因此它是在默认的“无模式”托管模式中未定义为多值的少数字段之一。
由于5.x默认情况下使用托管模式-如果在升级后第一次启动Solr时没有正确的schema.xml文件,则可能会发生这种情况。 您可以通过在solrconfig.xml
使用ClassicIndexSchemaFactory来更改此行为。
_version_
字段是必需的,因为Solr内部存在-它必须存在于架构中,因为它用于部分更新(即,其他人在提交零件之前已经更新了文档),SolrCloud模式(哦,我已经有了该版本从群集中的其他节点)和UpdateLog(无需更新已经存在的内容)..以及其他一些功能。
另一个“魔术”字段是_root_
,用于实现子文档支持。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.