繁体   English   中英

如果仅在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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM