加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Solr5.5使用schema.xml

发布时间:2020-12-16 08:37:53 所属栏目:百科 来源:网络整理
导读:与之前版本不同,Solr5.5中默认不再使用schema.xml,取而代之的是Managed Schema,此种方式必须通过Schema API的方式进行管理,不太方便。现在改为传统的schema.xml的配置文件方式。 以下是简介: “ The schemaFactory option in solrconfig.xml controls wh

与之前版本不同,Solr5.5中默认不再使用schema.xml,取而代之的是Managed Schema,此种方式必须通过Schema API的方式进行管理,不太方便。现在改为传统的schema.xml的配置文件方式。

以下是简介:

The schemaFactory option in solrconfig.xml controls whether the Schema should be defined as a
"managed index schema": schema modification is only possible through the Schema API.
All of the example config sets use the managed schema by default.
By default,if no schemaFactory is specified,then the default behavior is to use the "ClassicIndexSchemaFactory":
<schemaFactory class="ClassicIndexSchemaFactory"/>
The ClassicIndexSchemaFactory requires the use of a schema.xml file,which can be edited manually and
is only loaded only when the collection is loaded. This setting disallows Schema API methods that modify the
schema.


首先通过默认方式启动solr 并创建core(这里命名为core1),这样会在solr-5.5.0/server/solr/core1/conf 目录下生成managed-schema,将此文件拷贝至同目录下名字为schema.xml。

然后编辑/solr-5.5.0/server/solr/core1/conf/solrconfig.xml,将以下代码注释掉:

<schemaFactory class="ManagedIndexSchemaFactory">
<bool name="mutable">true</bool>
<str name="managedSchemaResourceName">managed-schema</str>
</schemaFactory>


同时新增<schemaFactory class="ClassicIndexSchemaFactory"/>


最后重启solr即可。


【Q&A】

1. Caused by: org.apache.solr.common.SolrException: Invalid Number: MA147LL/A

此问题是由于将schema.xml中的id设置为了int类型,<field name="id" type="int"

解决方式是把solr-5.5.0/server/solr/core1/conf中的elevate.xml的

<query text="ipod"> <doc id="MA147LL/A" /> <doc id="IW-02" exclude="true" /> </query> 注释掉

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读